Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Properly pass context to input filter #6154

Closed

Conversation

bakura10
Copy link
Contributor

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!

* @var InputFilter
*/
protected $filter;

Copy link
Member

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.

Copy link
Contributor Author

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 weierophinney added this to the 2.4.0 milestone Apr 17, 2014
@weierophinney weierophinney self-assigned this Apr 17, 2014
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
(detailing BC break)
weierophinney added a commit that referenced this pull request Apr 17, 2014
@weierophinney
Copy link
Member

Merged to develop for release with 2.4.0.

wdalmut pushed a commit to wdalmut/zf2 that referenced this pull request Apr 24, 2014
wdalmut pushed a commit to wdalmut/zf2 that referenced this pull request Apr 24, 2014
freax pushed a commit to freax/zf2 that referenced this pull request Nov 27, 2014
@svycka
Copy link
Contributor

svycka commented Apr 8, 2015

@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants