Skip to content
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

PR#2012 caused 404 exception in spark #2021

Closed
nowackipawel opened this issue May 22, 2019 · 1 comment · Fixed by #2024
Closed

PR#2012 caused 404 exception in spark #2021

nowackipawel opened this issue May 22, 2019 · 1 comment · Fixed by #2024

Comments

@nowackipawel
Copy link
Contributor

This line:

		$this->HTTPVerb = is_cli() ? 'cli' : Services::request()->getMethod();```
has been changed to:
	$this->HTTPVerb =  Services::request()->getMethod();

and this is the result
``

CodeIgniter CLI Tool - Version 4.0.0-beta.3 - Server-Time: 2019-05-22 14:22:25pm

ERROR: 404
Can't find a route for 'cimigrate'.

@MGatner
Copy link
Member

MGatner commented May 22, 2019

Just found this myself (codeigniter4/devstarter#2). The issue is that CodeIgniter.php's spoofRequestMethod() is actually setting the method on clirequest service (see getRequestObject()) and RouteCollection is always checking request service. I think there is no way around checking for CLI in the RouteCollection constructor.

MGatner added a commit to MGatner/CodeIgniter4 that referenced this issue May 22, 2019
CodeIgniter.php sets the request method on `request` or `clirequest` service, so RouteCollection needs to check the proper service to get the correct HTTPVerb to account for CLI, spoofing, and standard scenarios.
See codeigniter4#2021
lonnieezell added a commit that referenced this issue May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants