Part of the EllisLab Network

Bug Report

Controller dispatching bug codeigniter.php

Date: 07/13/2007 Severity: Minor
Status: Duplicate Reporter:
Version: 1.5.4
Keywords:

Description

This bug is not new to CI 1.5.4

I ran into a problem with routes today that forced me to modify codeigniter.php at line 216. I’m not entirely certain that I’m doing the right thing here, but I definitely need this looked at.

The problem is that when you have a matched route which routes to a controller in a subdirectory the method parameters are not passed correctly.

Code Sample

// THE FIX

/*
Explanation:
The rsegments array already has the foldername removed, as part of the route matching routines. Therefore the parameters ALWAYS start a position 2
*/

// the original line 216 in codeigniter.php
call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments, (($RTR->fetch_directory() == '') ? 2 : 3)));

// my modification
call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments, 2));


// The following is from my routes.php
// retail is a controller folder, imagelibrary the controller
// I know the route looks whacko, but i need it because
// of the generic mapping for all other functions in the
// 2nd route

$route['retail/imagelibrary(.*)']='retail/imagelibrary$1';
$route['(consumer|retail)(.*)']='$1/$1$2';

Expected Result

Calling the url:
/retail/imagelibrary/gallery/blushingbride

will find and execute the imagelibrary controller and the gallery function. However, the parameter for ‘blushingbride’ is not passed.

Actual Result

Comment on Bug Report

Page 1 of 1 pages
Posted by: Derek Jones on 30 January 2008 1:42am
Derek Jones's avatar

Whoops, I missed this report in the list and already resolved the more recent report.

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?