-
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: routing behavior when $uriProtocol is QUERY_STRING #7199
fix: routing behavior when $uriProtocol is QUERY_STRING #7199
Conversation
Make it the same behavior as when URIProtocol is REQUEST_URI.
The auto routing is disabled, so defined route should be used, or 404 should happen.
public function testPathRequestURINested() | ||
{ | ||
$this->request->uri = '/ci/index.php/woot?code=good#pos'; | ||
// /ci/index.php/woot?code=good#pos | ||
$_SERVER['REQUEST_URI'] = '/index.php/woot'; | ||
$_SERVER['SCRIPT_NAME'] = '/index.php'; |
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 don't know what is Nested
(in the method name), and why
the URI path is /ci/index.php/woot?code=good#pos
but $_SERVER['REQUEST_URI']
is /index.php/woot
.
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'm not sure either! Was that my code? It probably just means "in a subdirectory".
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.
No, not your code.
Description
From https://forum.codeigniter.com/showthread.php?tid=86284&pid=406192#pid406192
When
Config\App::$uriProtocol
isQUERY_STRING
and accessing baseURL:/
is ignored, and routed to the default controllerDebug/Toolbar/Collectors/Routes.php
throws "ReflectionException: Class "Home" does not exist"How to Reproduce
(1) set
CI_ENVIRONMENT = production
in.env
, and runspark serve
.Navigate to
http://localhost:8080/
.You will see the Welcome page. But it should be 404 Not Found.
Because
Index::index
does not exist.(2) set
CI_ENVIRONMENT = development
in.env
, and runspark serve
.Navigate to
http://localhost:8080/
.Checklist: