Part of the EllisLab Network
   
 
support for less than two GET parameters within the url
Posted: 17 December 2006 08:20 AM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  78
Joined  12-17-2006

using CI for about three weeks now in development I came accross one small strange behaviour
when using GET params like

www.example.com/mycontroller/myfunc.html?blub=something

you get a 404 while

www.example.com/mycontroller/myfunc.html?blub=something&bla=somethingelse

doesnt get you there

Thats caused by a function within the router class which checks if there is exactly one get param given and which causes the name of this param
to resolve to the controller.
So with above example it tries to call controller ‘blub’ which doesnt exist of course : )

To fix that ... here a patch against the Router.php which fixes this based on the config setting for segmented urls (if we do or dont want to use them)
Maybe one could also better use some other config directive though

--- Router.php.old  2006-12-17 11:36:06.000000000 +0100
+++ Router.php  2006-12-17 13:14:40.000000000 +0100
@@ -293,7 +293,7 @@
            
// build the URI string from the zero index of the $_GET array.
            // This avoids having to deal with $_SERVER variables, which
            // can be unreliable in some environments
-           if (is_array($_GET) AND count($_GET) == 1)
+           if (
$this->config->item('enable_query_strings') === TRUE AND is_array($_GET) AND count($_GET) == 1)
            
{
                
// Note: Due to a bug in current() that affects some versions
                // of PHP we can not pass function call directly into it

I hope this is going to be found useful and that I am not off the road with this : )

greets Rico

 Signature 

moormanweb.info

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120010 Total Logged-in Users: 45
Total Topics: 126142 Total Anonymous Users: 2
Total Replies: 663555 Total Guests: 428
Total Posts: 789697    
Members ( View Memberlist )