This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Properly pass context to input filter #6154
Closed
Closed
Conversation
This file contains 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
* @var InputFilter | ||
*/ | ||
protected $filter; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't technically necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My PHPStorm didn't give me any auto completion without that
weierophinney
added a commit
that referenced
this pull request
Apr 17, 2014
Properly pass context to input filter
weierophinney
added a commit
that referenced
this pull request
Apr 17, 2014
Merged to develop for release with 2.4.0. |
wdalmut
pushed a commit
to wdalmut/zf2
that referenced
this pull request
Apr 24, 2014
(detailing BC break)
wdalmut
pushed a commit
to wdalmut/zf2
that referenced
this pull request
Apr 24, 2014
(detailing BC break)
freax
pushed a commit
to freax/zf2
that referenced
this pull request
Nov 27, 2014
(detailing BC break)
@bakura10 maybe similar thing should be added into forms ant fieldsets? |
weierophinney
added a commit
to zendframework/zend-inputfilter
that referenced
this pull request
May 15, 2015
…-input-filter-context Properly pass context to input filter
weierophinney
added a commit
to zendframework/zend-inputfilter
that referenced
this pull request
May 15, 2015
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Hi,
I was quite surprised to see this bug. Basically, the "isValid" method of input filter did not allow to pass any context, which in hence could not be transfered to various validators, that made it impossible to use some validators that relied on context.
The problem is that input filter actually considered the whole array data as context, and pass it to various inputs.
To avoid any BC, I just checked if a context was explicitly given in the input filter. If that's the case, this context is preferred over the data as array.
Thanks!