Closed neznaika0 closed 1 year ago
What's wrong with it?
What do you mean by ["except" => []]
?
Why do you need to put empty array?
Because it happened by accident. I'm commenting out the values in except and not the whole array.
This may be difficult to imagine, but ['except' => []]
or ['except' => '']
means "except all".
You can check filters with php spark routes
.
Do you think the behavior is not good for security?
form_open()
is no problem. It just checks if CSRF filter is applied or not.
Do you think the behavior is not good for security?
Perhaps. I turned off the protection on the whole project like that)
I left home, I'll look at the console in a few days.
In my opinion, it is better to delete empty values except. When it []
or "
it should mean "apply filter to all without exceptions"
I certainly don't know why it is behaving that way, but perhaps it has been that way from the beginning.
Maybe it is a dangerous behavior that developers do not expect. It may be better to fix it as a bug.
Ah, I got why that way. It must be a bug in except
.
Great. Just try to understand the phrase "Apply filter X to all routes, but exclude all routes". It looks stupid
I sent PR #7823 to fix the behavior of Controller Filters.
form_open()
is no problem. So I close this issue.
PHP Version
8.2
CodeIgniter4 Version
4.3.7
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Linux
Which server did you use?
cli-server (PHP built-in webserver)
Database
No response
What happened?
See https://forum.codeigniter.com/showthread.php?tid=88247&pid=411790#pid411790 If in app/Config/Filters.php "csrf" have empty array "except" CSRF field not write in HTML. If "except" filled - all work.
Steps to Reproduce
Set
"csrf" => ["except" => []]
, insert form_open() in template and see source code. csrf field not installedExpected Output
Insert token if except empty array
Anything else?
No response