Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.6

Bug #10844 Validate::multiple() breaks by consolidating single field array
Submitted: 2007-04-26 11:16 UTC
From: gsiab Assigned: toggg
Status: Closed Package: Validate (version 0.7.0)
PHP Version: Irrelevant OS:
Roadmaps: 0.8.0    
Subscription  


 [2007-04-26 11:16 UTC] gsiab (Alexander Brausewetter)
Description: ------------ Validate::multiple() failes to work properly with a one field option set because it applies array_pop() on single field configurations. This breaks at least Validate::string() which expects at least array('format' => ...) as its option configuration. When more than one option is included into the configuration, behaviour is as expected. Release Date 2006-11-17 20:02:53 Release Version 0.7.0 (beta) API Version 0.7.0 (beta) Test script: --------------- $vals = array( 'test' => 'dsfasdf', ); $opts = array( 'test' => array( 'type' => 'string', 'format' => '0-9' ) ); var_dump(Validate::multiple($vals, $opts)); Expected result: ---------------- Validation should fail. Actual result: -------------- Validation succeeds because the format config is not passed and thereby not evaluated.

Comments

 [2007-04-26 16:35 UTC] toggg (bertrand Gugger)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. I could not use your patch as it was breaking pear run-tests multiple.phpt in case the second parameter is an array as 'date' => array('type' => 'date', array('format' => '%d%m%Y')) Anyway, you were right, the pop needs to be done only in that case. Thanks.