-
Notifications
You must be signed in to change notification settings - Fork 130
[1813] Fix errors when URL parameters like "filter[status]" aren't strings #1814
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
Conversation
I am testing this PR in 2 installations, one with PHP7.4 and another with PHP8.0. In PHP7.4 I get warnings, but in PHP8.0 I get I am using this GET string to test this PR:
I suggest one new check, to resolve some notices I get with PHP7.4:
In the
to
|
The problem is more vast, unfortunately not only the key To fix it, I propose sanitize it immediatly after the |
In 1e294de I've updated the check for the int values sent through |
Problem
If the translations filter in the URL parameter sends an array, for example
...?filters[status][0]=current&filters[status][1]=fuzzy
, thegp_array_get( $filters, 'status', 'current_or_waiting_or_fuzzy_or_untranslated' )
will return an array instead of a string.This errors on subsequent
explode( '_or_', $selected_status )
.Solution
If the statuses set on URL get parameters are not the predictable ones, fallback to
thean empty string.current_or_waiting_or_fuzzy_or_untranslated
Testing Instructions
...?filters[status]=current_or_fuzzy
URL parameters to...?filters[status][0]=current&filters[status][1]=fuzzy
Fixes #1813