ZF-9127: Zend_Form_Element :: _loadValidator() behaviour is changed in 1.10.0 (not backward compatible)

Issue Type: Bug Created: 2010-02-09T13:12:40.000+0000 Last Updated: 2010-10-26T02:41:16.000+0000 Status: Resolved Fix version(s): Reporter: Bart Blaszczyk (bartblaszczyk) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: - ZF-7153



The behaviour of _loadValidator() is changed. In previous realeases the validator was instantiated, if it had a constructor - through a ReflectionClass with newInstanceArgs() and with (array) $validator['options'] as the parameter. In 1.10.0 the parameter is passed as $validator['options'] (no array casting) to newInstance() function, if all the options have keys (which is always the case, when loading the form from a config file).

Example stack trace:

file: /library/Bb/Validate/MatchField.php line: 25 function: errorHandler args: int(2), string(60) "Missing argument 2 for Bb_Validate_MatchField::__construct()", string(35) "/library/Bb/Validate/MatchField.php", int(25), array(1) {array(2) {string(5) "email", string(3) "t_3"

function: __construct args: array(2) {string(5) "email", string(3) "t_3"}

file: /library/Zend/Form/Element.php line: 2101 function: newInstance args: array(2) {string(5) "email", string(3) "t_3"}

file: /library/Zend/Form/Element.php line: 1246 function: _loadValidator args: array(3) {string(10) "MatchField", bool(false), array(2) {string(5) "email", string(3) "t_3"

file: /library/Zend/Form/Element.php line: 1319 function: getValidators args: -



Posted by Christian Albrecht (alab) on 2010-03-14T09:20:30.000+0000

The behaviour of constructing Validators was indeed changed in 1.10.

See [ZF-7153] There is now only one argument, an array, passed to the _construct method.

Not an Issue.

Posted by Bart Blaszczyk (bartblaszczyk) on 2010-03-17T08:28:00.000+0000

But why this is not described in the migration notes? Upgrading to 1.10.x broke my applications.

Posted by Marc Hodgins (mjh_ca) on 2010-10-26T02:41:15.000+0000

Marking as 'not an issue' and 'resolved'. Unfortunately the change did cause an intentional BC break. See ZF-7153 for why this was necessary.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.