• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URI mapping anomoly

I don't use the standard CI routing for URI's because I sometimes use parameters where that makes sense but I like the automatic routing and the clean URI structure.

So in config I have: $config['enable_query_strings'] = TRUE;
Then I have URI's like: foo.bar.com/xxx/yyy/zzz?a=b&c=d
I have a custom routing: $route['xxx/yyy/zzz'] = "xxx/yyy/zzz";
In the xxx controller yyy method I then have code like this:
$a = $this->input->get('a');
$c = $this->input->get('c');

This works just fine, the right method in the right class gets called with the right parameter value("zzz") and $a has the value 'b' and $c has the value 'd'.
The problem occurs when I try: foo.bar.com/xxx/yyy/zzz?a=b
In this case I get a 404 page 'a' not found.

The reason for this is that in Uri.php in the _fetch_uri_string method the following code is found:
if (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '')
$this->uri_string = key($_GET);
I think that this should be removed so that using custom routes with query strings works properly. I have these lines commented out and it all works perfectly even if there is only 1 parameter.

Even better would be directly supporting this style of URI without requiring the custom routing entry.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.