Hi Matthew, Even though the 2.2.3 release fixed the previously undiscovered bug, it has as you noted broken the behaviour that has been standard so far.
I recommend towards setting the flag to true by default, and either an immediate 2.2.4 release, or a notification of some type as to the usage of the setPreferFormInputFilter method. I strongly recommend an immediate release of 2.2.4, as I upgraded to 2.2.3 via composer, which means I did not immediately see the changelog, just a broken application. Regards, Michael Gooden On 23 August 2013 19:52, Matthew Weier O'Phinney <matt...@zend.com> wrote: > On Fri, Aug 23, 2013 at 3:27 AM, Wim Kumpen <wim.kum...@addemar.com> > wrote: > > Just checking if someone has the same problem after upgrading from 2.2.2 > to > > 2.2.3. > > I have a form with validation. After upgrading, the not required fields, > are > > suddenly required. > > After some discussion with Michael Gallego and tracking down what is > happening under the hood, this is what I discovered: > > - Prior to 2.2.3, the `setPreferFormInputFilter()` flag didn't really > do anything, though it was supposed to. The reason it didn't really do > anything is because the order of operations in > `attachInputFilterDefaults()` was incorrect, and was merging inputs > too soon. This had necessitated a strange situation in > `Zend\InputFilter\BaseInputFilter::add()` wherein the old input was > being merged to the new one, and then the new one placed in the input > filter... > > - Which was clearly wrong, because it meant that flags and settings in > the new input were getting overwritten by the old ones. For this > reason, issue #4996 was created. > > - In fixing #4996, I corrected the behavior in > `attachInputFilterDefaults()`, which now means that you need to call > `setPreferFormInputFilter()` and pass it a boolean `true` if you are > defining forms via configuration and/or using fieldsets or elements > that implement `InputFilterProviderInterface` and/or > `InputProviderInterface`. > > So, the way you can get the pre-2.2.3 behavior is to simply do this: > > $form->setPreferFormInputFilter(true); > > The question I have to everyone is: should that flag be set to true by > default? And, if so, should this be done for an immediate 2.2.4 > release, should it wait for the regular 2.2.4 release (third Wednesday > in September), or wait for 2.3.0? > > Thoughts? > > > Just a part of the code: > > > > > > $this->inputFilter = new InputFilter(); > > $factory = new InputFactory(); > > > > $this->inputFilter->add( > > $factory->createInput( > > array( > > 'name' => 'website', > > 'required' => false, > > 'filters' => array( > > array('name' => 'StripTags'), > > ), > > 'validators' => array( > > array( > > 'name' => 'Uri', > > 'options' => array( > > 'uriHandler' => "\Zend\Uri\Http", > > 'messages' => array( > > Uri::NOT_URI => "The input does not > > appear to be a valid Url", > > ) > > ) > > ) > > ) > > ) > > ) > > ); > > > > > > I found something in the 'Form' class, 'attachInputFilterDefaults' > method. > > Fields like 'email', 'url' are instances of InputProviderInterface and > then > > he gets getInputSpecification() ... And that will overwrite my settings. > I > > can fix this with setting 'preferFormInputFilter' on true. But I didn't > have > > to do that in 2.2.2 so ... > > > -- > Matthew Weier O'Phinney > Project Lead | matt...@zend.com > Zend Framework | http://framework.zend.com/ > PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc > > -- > List: fw-general@lists.zend.com > Info: http://framework.zend.com/archives > Unsubscribe: fw-general-unsubscr...@lists.zend.com > > >