laminas / laminas-inputfilter

Normalize and validate input sets from the web, APIs, the CLI, and more, including files
https://docs.laminas.dev/laminas-inputfilter/
BSD 3-Clause "New" or "Revised" License
42 stars 28 forks source link

CollectionInputFilter - isValid does not pass $context variable #42

Closed vaclavvanik closed 2 years ago

vaclavvanik commented 2 years ago

CollectionInputFilter::isValid($context = null) does not pass $context variable to nested input filter. I do not know if it is expected behavior.

I need to get whole input filter $context from my nested validators. If it is bug, I can create PR. If it is expected behavior I can create PR with new ContextCollectionInputFilter which will pass $context to nested input filter.

froschdesign commented 2 years ago

@vaclavvanik The related DocBlock contains:

https://github.com/laminas/laminas-inputfilter/blob/b6ab28b425e626b12488fec243e02d36d8dffeff/src/CollectionInputFilter.php#L209

But I don't know why it is ignored.

If it is bug, I can create PR. If it is expected behavior I can create PR with new ContextCollectionInputFilter which will pass $context to nested input filter.

Another input filter class is not needed. Please create a pull request and update the class Laminas\InputFilter\CollectionInputFilter directly. The tests should show if there are any side effects. Thanks in advance! 👍