-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: $routes->setDefaultMethod() does not work #5682
fix: $routes->setDefaultMethod() does not work #5682
Conversation
Wrong approach. |
Removed |
3488391
to
7facfb0
Compare
The default method may be not `index`, and it is set in the constructor.
The constructor of the Router class already defines the default controller.
7facfb0
to
2822a18
Compare
Removing a protected method is a breaking change. I reverted |
system/Router/Router.php
Outdated
@@ -646,8 +640,6 @@ protected function setRequest(array $segments = []) | |||
{ | |||
// If we don't have any segments - try the default controller; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is no longer true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. "try" is strange.
Updated.
if (empty($segments)) { | ||
$this->setDefaultController(); | ||
} | ||
// If we don't have any segments left - use the default controller; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment should also be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is true. I don't think to be removed.
Co-authored-by: John Paul E. Balandan, CPA <51850998+paulbalandan@users.noreply.github.com>
Description
$routes->setDefaultMethod()
does not work when you go to/
See https://forum.codeigniter.com/thread-81269.html
Checklist: