Another php bug?
Tonight 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.
September 1st, 2009 at 8:57 pm
Mayby a bit late, but: This problem does arise to when two or more slashes are in the url. One of the $_SERVER variables you mentioned will remove the extra slashes, while the other will just keep the url in tact.
Why this is like it is… I don’t know 😉
Greetings,
Thanaton