Part of the EllisLab Network
   
 
Bug in CodeIgniter.php parameter not passed with custom route & controller in subdirectory
Posted: 15 January 2007 05:18 AM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  166
Joined  08-31-2002

If you are using a custom route that routes to a controller in a subdirectory, then the first parameter after the class/method will not be passed to the method. See this thread: http://codeigniter.com/forums/viewthread/47371/.

in /application/codeigniter/CodeIgniter.php

at line ~217, change:

call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments, (($RTR->fetch_directory() == '') ? 2 : 3)));

to

if ($RTR->rsegments == $RTR->segments)
{
    call_user_func_array
(array(&$CI, $method), array_slice($RTR->rsegments, (($RTR->fetch_directory() == '') ? 2 : 3)));
}
else
{
    call_user_func_array
(array(&$CI, $method), array_slice($RTR->rsegments, 2));
}

Basically the Router class strips any directory from the rsegments array anyway, so the code that moves the offset of array_slice is reduntant and (SHOULD) be safe to remove.

Update: My previous fix broke normal URLs to controllers in sub-dirs. This is a bit of a kludge the alternative meant re-writing portions of the base Router.php class which I didn’t want to do.

Profile
 
 
Posted: 19 April 2007 12:44 PM   [ Ignore ]   [ # 1 ]  
Grad Student
Rank
Total Posts:  51
Joined  09-12-2006

Hi

Look here and tell me if this solve your problem too??

thanks

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 719, on June 06, 2008 10:16 AM
Total Registered Members: 66414 Total Logged-in Users: 31
Total Topics: 84753 Total Anonymous Users: 0
Total Replies: 454833 Total Guests: 227
Total Posts: 539586    
Members ( View Memberlist )
Newest Members:  paulevansbyrooNirCalexmuellerkizerdrixcaptainredmuffquinodligtharttechsivamDjordje