Welcome Guest, Not a member yet? Register   Sign In
Routing problems with CodeIgniter.php SVN r:1002
#1

[eluser]Unknown[/eluser]
Hello,
I've updated CodeIgniter.php at revision 1002 from SVN, and my routing rules stop working. For example:

$route['mirror/(:any)/'] = 'extrasite/$1';

I've detected that the problems is the case sensitive routing. For example:

In the controller:
function getAddress(){}

When I call: mirror/getAddress
I doesn't work, but if I try with: mirror/getaddress , it works.
#2

[eluser]Derek Jones[/eluser]
It's not your routing, iGN, it's the request URI. I made a change the other day to prevent CI from trying to call private and protected methods from the URI:

Code:
if (! in_array($method, get_class_methods($CI)))

method_exists() and is_callable() unfortunately both report TRUE when they shouldn't, so the above had to be used, and in_array() is of course case-sensitive. Since we're dealing with URIs here, which are technically case sensitive, I'm on the fence. My gut says that this should have been the behavior of CI from the beginning, and that treating the request as case insensitive is wrong. However, PHP is case insensitive with method names, so a developer wouldn't even be able to have identical methods with different casing. But the visitor shouldn't be exposed to the technology the site is running on; if we were working with static files, your users would get 404s if they tried to use casing that did not match your file structure. Hrm.
#3

[eluser]Derek Jones[/eluser]
Oh, and regarding your custom route, I get the opposite behavior from what you describe. It works case-sensitive just like a direct request would in the same revision, and a trailing slash in the route would not match on either of the URIs.
#4

[eluser]Derek Jones[/eluser]
Do a checkout of rev 1003, iGN, I've committed a change that will keep the old behavior, but still include the protection for private and protected methods in PHP5.




Theme © iAndrew 2016 - Forum software by © MyBB