Another php bug?
Saturday, April 12th, 2008Tonight I had trouble with parsing url’s.
I wanted to create some SEO-friendly url’s for a new site and the PATH_INFO server variable is a good base for it.
My url:
site/productname/camera
It’s easy to parse the url to segments with an explode on “/”
But I had a specific url that caused me troubles:
site/productname/cameraz.
Strangely the trailing dot disappeared:
echo $_SERVER['PATH_INFO']
site/productname/cameraz
while
echo $_SERVER['REQUEST_URL']
site/productname/cameraz.
That’s weird. I never saw those differences before.
I tried it on an old server with php 5.1.2. And NO difference there.
Somehow a bug entered in php 5.2.5 that deletes a trailing dot in $_SERVER[‘PATH_INFO’].
Be aware!
Of course it can also be caused in interaction with the apache-server.