Uh oh!
There was an error while loading. Please reload this page.
fix: filter except empty - #7823
Conversation
Strictly speaking, this may be a breaking change. However, it does not appear that any developer would want to disable the filter by specifying an empty array or empty string. If there is, it would be a case of specifying them by mistake and not realizing that the filter is disabled. |
datamweb
commented
Aug 15, 2023
I agree that this should not be the behavior. ['except' => [
'*',
]];
// or
['except' => '*' ]; |
kenjis
commented
Aug 15, 2023
neznaika0
commented
Aug 15, 2023
Ha, it's wrong, but it will work. To exclude everyone, you need to remove the filter. There is no logic to enable the filter and disable it by rules |
datamweb
commented
Aug 15, 2023
I was considering the implementation with the Settings package. It looks good to me. |
This behavior is unexpected and not good for security. If a dev removes all items in `except` key, the filter is disabled. Now "except empty" means "except nothing".
The URI path '' means the baseURL. So ['except' => ''] should mean that except for the baseURL only.
kenjis
commented
Aug 16, 2023
The URI string I changed that way. |
MGatner
left a comment
There was a problem hiding this comment.
I agree this is a good fix for a common "gotcha"
Description
See #7822 (comment)
This PR changes the behavior:
['except' => []]means to exclude nothing.['except' => '']means to exclude baseURL only.''means the URI path for the baseURL.uri_string()returns''.['except' => []]or['except' => '']means "except all" in the current code.This behavior is unexpected, and not good for security.
If a dev comments out all items in
exceptkey accidentally, the filter will be disabled.Checklist: