Routing in 1.5.4 breaks my apps |
[eluser]Michael Ekoka[/eluser]
I just updated my copy of CI from 1.5.3 to 1.5.4 and the routing breaks my application with the following error: The URI you submitted has disallowed characters. I replaced the current Router.php file with my old one and it works. Could anyone tell me what was changed in the two files? Thanks. Mike
[eluser]Michael Wales[/eluser]
In config.php Code: /* Note: This is the default setting from that file - you will need to modify for your own needs.
[eluser]coolfactor[/eluser]
What are some of the uri's that are breaking in your apps. Please give examples.
[eluser]Michael Ekoka[/eluser]
Thanks walesmd and coolfactor for responding. To answer your question, coolfactor, the problem was specific to the index urls of the application, more precisely the ones of the form: http://host/my_app_home http://host/my_app_home/ any other urls was working, i.e: http://host/my_app_home/index.php http://host/my_app_home/controller_x http://host/my_app_home/controller_x/action_y etc. I was able to fix my problem without changing the CI installation by modifying my .htaccess file from: Quote:<IfModule mod_rewrite.c> to Quote:<IfModule mod_rewrite.c> Now, after inspecting the code, I found out why it used to work in v.1.5.3 and not in 1.5.4. There have been some modifications to the whole url sanitization process. The old Router.php class had a little routine that would remove the trailing slash in an empty url at around line 95-99 Code: // If the URI contains only a slash we'll kill it In 1.5.4, that routine has been moved to the URI class in the _fetch_uri_string() method, but that method more than likely returns before the check can be performed. As a result, if there's a trailing slash in the url, at some point in the process there will be an attempt to match the empty string to the list of permitted characters (see _explode_segments() and _filter_uri() methods in URI.php v.1.5.4, lines 225 & 188). That's where the error comes from. I would suggest to reinsert the check for the trailing slash into the process at some point. This is probably a trivial change.
[eluser]Michael Ekoka[/eluser]
First my apologies guys: I just downloaded the stable version of CI and realized that the code that had previously been breaking my applications is only in the svn repository. UPDATE: changing my mod_rewrite like described earlier only fixed the problem for the index url, but created another for the rest of the site. So I reverted back to my original mod_rewrite script (which btw works fine in stable 1.5.4). Now, to the development team, with some luck they might read it: - in the URI.php file currently in the repository, between line 119 and 223, you have this little check that almost never gets a chance to run, because the _fetch_uri_string() method will more than likely return before it. This creates the problem that I described in my original post. Code: // If the URI contains only a slash we'll kill it Thank you for your time. |
Welcome Guest, Not a member yet? Register Sign In |