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

before function in FilterInterface is missing response param #2085

Closed
fherein opened this issue Jul 2, 2019 · 3 comments
Closed

before function in FilterInterface is missing response param #2085

fherein opened this issue Jul 2, 2019 · 3 comments
Labels
enhancement PRs that improve existing functionalities

Comments

@fherein
Copy link

fherein commented Jul 2, 2019

Describe the bug
before function in FilterInterface is missing response param, but there is a check in Filters.php "if before return response object". As it is great place to validate conditions and return back error http codes if needed, I believe response parameter should be part of this function.

CodeIgniter 4 version
Current develop / beta 3

Affected module(s)
Filters, FilterInterface + modifications needed in builtin filters (Debug, Honeypot, CSRF)

Expected behavior, and steps to reproduce if appropriate
I expect to get response object in before function for straightforward modifications and return.

Context
Not needed.

I can prepare PR, unless this is something you would like to change yourself. Or there is better way, how to achieve goal mentioned above.

@lonnieezell
Copy link
Member

You can always grab the current response via:

$response = Config\Services::response();

fherein added a commit to fherein/CodeIgniter4 that referenced this issue Jul 2, 2019
@fherein
Copy link
Author

fherein commented Jul 2, 2019

Thanks for the info, i overlooked this possibility as i was trying to create response from HTTP/Response instead of Config\Services. It is working as expected. I still believe that lots (maybe most) of use cases for before filter will be validation and prevention of further code processing and having response natively would be more friendly and readable. But of course now with your solutions it is not critical for me. Please you can ignore my commit above as I was primarily trying process of contribution :) If you think response in before function would do more harm then good, I believe this can be closed already. Thank you for your help!

@jim-parry jim-parry added this to the 4.0.0-rc.2 milestone Sep 8, 2019
@jim-parry jim-parry removed this from the 4.0.0-rc.2 milestone Sep 23, 2019
@jim-parry jim-parry added the enhancement PRs that improve existing functionalities label Sep 23, 2019
@jim-parry
Copy link
Contributor

This should be discussed/resolved on the forum before showing up here.

@MGatner MGatner closed this as completed Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PRs that improve existing functionalities
Projects
None yet
Development

No branches or pull requests

4 participants