CodeIgniter Forums
problem with enable_query_strings=TRUE and uri_protocol=AUTO - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: problem with enable_query_strings=TRUE and uri_protocol=AUTO (/showthread.php?tid=11857)



problem with enable_query_strings=TRUE and uri_protocol=AUTO - El Forum - 09-25-2008

[eluser]Unknown[/eluser]
If I set enable_query_strings=TRUE and uri_protocol=AUTO I have problems with opening the default controller URL with one single parameter. I always get the 404 error.
I looked into the URI class and found that the problem was in the following code in the URI::_fetch_uri_string() function:
Code:
if (is_array($_GET) AND count($_GET) == 1 AND trim(key($_GET), '/') != '')
    {
        $this->uri_string = key($_GET);            
        return;
    }
This code returns only the name of the 1st parameter instead of the entire query string and as a result, the router considers this parameter name as a controller name, wants to load it and fails.
Does anybody know why it works this way? It would be logically if it returned a string key($_GET).'='.current(_$GET)
Of course after having modified the code the problem disappeared.
So, is it a feature which I just do not understand or it's a bug?