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
There is a bug while defining as in the route. When I use $routes->add('admins/suspend/(:num)', 'AdminsController::suspend/$1', ['as' => 'suspend_admin']);
It give me error exception,
Undefined offset: 0
SYSTEMPATH\Router\RouteCollection.php at line 1347
When I change ['as' => 'suspend_admin'] to ['as' => 'suspends_admin'] or to anything its working.
Please check this, why it don't accept suspend_admin?
Error generating
The error is only generate when I use base_url(route_to('suspend_admin') ). It looks like the issue is because of the dynamic argument.
When I remove (:num) the issue becomes to fix.
CodeIgniter 4 version
4.0.4
Affected module(s)
Route
Context
OS: Window 10
Apache 2.4.46
7.4.10
The text was updated successfully, but these errors were encountered:
SyedMuradAliShah
added
the
bug
Verified issues on the current code behavior or pull requests that will fix them
label
Oct 6, 2020
Please read how to use route_to() function in the user guide.
Basically, if you define a parameter in your URL, then you have to apply it to the function. In your case, something like this should work: route_to('suspend_admin', 123).
Describe the bug
There is a bug while defining as in the route. When I use
$routes->add('admins/suspend/(:num)', 'AdminsController::suspend/$1', ['as' => 'suspend_admin']);
It give me error exception,
When I change
['as' => 'suspend_admin']
to['as' => 'suspends_admin']
or to anything its working.Please check this, why it don't accept suspend_admin?
Added errorHandler ( arguments )
Error generating
The error is only generate when I use
base_url(route_to('suspend_admin') )
. It looks like the issue is because of the dynamic argument.When I remove
(:num)
the issue becomes to fix.CodeIgniter 4 version
Affected module(s)
Route
Context
The text was updated successfully, but these errors were encountered: