CodeIgniter4: Bug: Route redirection not working
Describe the bug After using
$routes->addRedirect('example', 'profile/dashboard');
I get an error
key() expects parameter 1 to be array, string given
but if the second param I set as named route then everything is working properly. The problem exists only when the second param is a URI
CodeIgniter 4 version 4.0.2
Affected module(s)
Router/Router.php at line 430
I not sure but here I found some changes for this line https://github.com/codeigniter4/CodeIgniter4/pull/2481/files#diff-d2374d65fd714c18dbee9f5adaa8dd6cL488
Expected behavior, and steps to reproduce if appropriate Redirection working properly for the second param as a URI .
Context
- OS: Ubuntu
- PHP version 7.3
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (9 by maintainers)
This problem is because
addRediret
before setRoutes, you can runI think this is the correct order
I just use
$routes->add
to test, This looks bad.Regarding your second question, I think you are right, I have made a change