You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The router should allow me to add routes in the following way: $routes->get( 'abcd/efgh', 'Pages::id/123' )
However, in the default Router (Codeigniter\Router), all the / in the$to parameter get overwritten by \. This breaks the functionality of the route since it starts looking at the Pages controller for the function id\123 (which does not exist).
Your own guidelines even have an example that has this kind of route in it. $routes->add('blog/joe', 'Blogs::users/34');
I have not actually tested this, but I guess that it fails for the same reasons as why my route is failing.
As far as I can tell, the way I want to route corresponds roughly with the routing described in the tutorial.
This problem seems to occur to the following lines of code in the checkRoutes( string $url ) function (in the Router, lines 471 to 474).
These lines translate all the / in $val to \. I don't know why this is done, but commenting those four lines fixes the problem for me (although I don't know what other consequences there are...).
CodeIgniter 4 version
Which version (and branch, if applicable) the bug is in.
The first Codeigniter beta version.
Expected behavior, and steps to reproduce if appropriate
I expect that my routes are routed to the controller with the 123 passed as the $id parameter.
Context
OS: [MacOS]
Using php spark serve
PHP version [7.3]
The text was updated successfully, but these errors were encountered:
I took the liberty of creating a PR that removes the translation of / into \ in the $to part of the routes. However, I cannot oversee all the consequences of this PR so please only merge if it does not break anything else (although I cannot quickly see what it would break 👍 ).
Describe the bug
The router should allow me to add routes in the following way:
$routes->get( 'abcd/efgh', 'Pages::id/123' )
However, in the default Router (Codeigniter\Router), all the
/
in the$to
parameter get overwritten by\
. This breaks the functionality of the route since it starts looking at thePages
controller for the functionid\123
(which does not exist).Your own guidelines even have an example that has this kind of route in it.
$routes->add('blog/joe', 'Blogs::users/34');
I have not actually tested this, but I guess that it fails for the same reasons as why my route is failing.
As far as I can tell, the way I want to route corresponds roughly with the routing described in the tutorial.
This problem seems to occur to the following lines of code in the
checkRoutes( string $url )
function (in the Router, lines 471 to 474).These lines translate all the
/
in$val
to\
. I don't know why this is done, but commenting those four lines fixes the problem for me (although I don't know what other consequences there are...).CodeIgniter 4 version
Which version (and branch, if applicable) the bug is in.
The first Codeigniter beta version.
Expected behavior, and steps to reproduce if appropriate
I expect that my routes are routed to the controller with the
123
passed as the$id
parameter.Context
php spark serve
The text was updated successfully, but these errors were encountered: