anandkunal / ToroPHP

Toro is a PHP router for developing RESTful web applications and APIs.
http://toroweb.org
MIT License
1.17k stars 173 forks source link

$_SERVER['PATH_INFO'] returns index.html #58

Closed codazoda closed 11 years ago

codazoda commented 11 years ago

This might be a configuration problem on my part.

The $_SERVER['PATH_INFO'] variable returns index.html (even though I don't even have that file in my process). I assume that's because it's something Apache is looking for. This causes the "/" router not to work. The others do. If I switch to using $_SERVER['REQUEST_URI'] it works fine. That's the third option in the Toro if statement though.

Is this a bug in the order of the $_SERVER variables it evaluates or a config problem on my side?

codazoda commented 11 years ago

I've updated the code to check REQUEST_URI first in order to solve this issue in my configuration. It feels like REQUEST_URI is the right variable to use, so I suspect it might be a good idea to check it first (preventing the other checks if it's good). I'll send a pull request with the update for you to review.

codazoda commented 11 years ago

Nevermind my previous commend. PATH_INFO makes more sense because it doesn't need to be manipulated. I'm still got some weirdness with mine returning 'index.html' even though I don't have an 'index.html' file.