Repository navigation
Conversation
Called without arguments, getArray() iterated over the input data and
passed each value as the filter name for its own key, so a field whose
value happened to be a filter name ("int", "bool", "array", ...) came back
corrupted. Strings are now filtered with the 'string' filter, as the
docblock promised, and other values are returned unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Called without arguments,
Input::getArray()iterates over the input data and calls$this->get($key, null, $value), so the client-supplied value becomes the filter name for its own key. A request withname=int&flag=bool&list=arraycomes back as['name' => 0, 'flag' => true, 'list' => ['array']], so anyone who types a filter name into a field gets corrupted data. The docblock promises filtering "using the default case in InputFilter::clean" instead.The no-argument case now walks the data itself: strings (also inside nested arrays) are filtered with the
stringfilter, which is what the default case ofInputFilter::clean()does, and other values (integers,null, …) are returned unchanged.Testing Instructions
New
InputTest::testGetArrayWithoutSpecifiedVariablesDoesNotUseValuesAsFilters()uses the realInputFilter(the existing test mocksclean()to return its argument, so it could not catch this). It fails before the change ('name' => 0,'html' => 'bold'missing etc.) and passes after it.Documentation Changes Required
docs/overview.md("Reading several values at once"): the warning about values being used as filter names is replaced by the actual behaviour.🤖 Generated with Claude Code