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

Bug #3189 setDefaults() bevaviour difference between PHP 5.0.2 and PHP 5.0.3
Submitted: 2005-01-13 19:10 UTC
From: ruempler at topconcepts dot de Assigned:
Status: Wont fix Package: HTML_QuickForm
PHP Version: 3.2.4pl1 OS: irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2005-01-13 19:10 UTC] ruempler at topconcepts dot de
Description: ------------ If you pass a string as value for a group of elements, QF shows different behaviour. So for example a checkbox in the group gets checked in PHP 5.0.3 but not in PHP 5.0.2. IMHO this issue was introduced with the PHP bugfix (PHP's string-as-array handling): http://bugs.php.net/bug.php?id=29883 Reproduce code: --------------- <? require_once 'HTML/QuickForm.php'; $form = new HTML_Quickform; $elements = array( HTML_Quickform::createElement('text', 'test1'), HTML_Quickform::createElement('checkbox', 'test2') ); $form->addGroup($elements, 'testgroup', 'blah', array(', ')); $form->setDefaults( array( 'testgroup' => 'blah' ) ); echo $form->toHtml(); ?> Expected result: ---------------- No checked checkbox. Actual result: -------------- Checkbox is checked.

Comments

 [2005-01-13 19:12 UTC] ruempler at topconcepts dot de
Sorry, QF Version is 3.2.4pl1 (I submitted the PHP Version)
 [2005-01-14 07:40 UTC] avb
Passing a string instead of an array is obviously an error on user's part.
 [2005-01-14 09:01 UTC] ruempler at topconcepts dot de
Ok that bug is triggered with DB_DataObject_Formbuilder. I'll ask them to fix it ;) Otherwise it should not much bloat the QF code to an is_array()? ;)