Skip to content

Conversation

@kenjis
Copy link
Member

@kenjis kenjis commented Jun 7, 2022

Description
Fixes #6086

The current implementation has two Request objects (IncommingRequest and CLIRequest) when running on CLI.
Because some classes call Services::request() inside and it always returns IncommingRequest.

When CLIRequest is used in CodeIgniter, developers assume that the CLIRequest object is used system-wide.
This PR makes that so.

Checklist:

@kenjis kenjis added bug Verified issues on the current code behavior or pull requests that will fix them breaking change Pull requests that may break existing functionalities labels Jun 7, 2022
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to think about this one a bit. On the one hand it is convenient (from a developer standpoint) to have the appropriate Request class anytime the service is called; on the other hand it complicates (from a coding standpoint) our PSR-15 layer even more.

@kenjis
Copy link
Member Author

kenjis commented Jun 7, 2022

Yes, we need to consider this.

@kenjis kenjis force-pushed the fix-4.2-cli-filter-bug branch 3 times, most recently from 782e340 to 388c4b5 Compare June 23, 2022 02:30
@kenjis
Copy link
Member Author

kenjis commented Jun 23, 2022

Changed the implementation a bit.

@kenjis kenjis force-pushed the fix-4.2-cli-filter-bug branch from a25153f to c31570d Compare June 23, 2022 04:06
@MGatner
Copy link
Member

MGatner commented Jun 23, 2022

I'm coming around to this. It is a bit hacky, but our current Request implementation is a mess so that might just need to be the case.

Let's see if we can get any more reviews and I'll keep chewing on it.

@kenjis
Copy link
Member Author

kenjis commented Jun 23, 2022

I've been thinking about it for a while and can't think of any other way to fix it except this way in the current situation.
Any idea is welcome.

@MGatner
Copy link
Member

MGatner commented Jun 24, 2022

If you've given this plenty of thought I don't feel the need to. At this point pretty much anything would be an improvement and what you've done looks reasonable to me.

@kenjis kenjis requested a review from samsonasik June 24, 2022 10:36
@kenjis kenjis force-pushed the fix-4.2-cli-filter-bug branch from 678b83f to bd754ec Compare June 26, 2022 09:31
@kenjis
Copy link
Member Author

kenjis commented Jun 26, 2022

Added changelog.

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny syntax changes then I'm good with this.

@kenjis kenjis merged commit 8a70700 into codeigniter4:develop Jun 26, 2022
@kenjis kenjis deleted the fix-4.2-cli-filter-bug branch June 26, 2022 23:39
@kenjis kenjis mentioned this pull request Aug 27, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Pull requests that may break existing functionalities bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: CI 4.2.0 - running CLI command with csrf enabled causes error

3 participants