PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #3189

setDefaults() bevaviour difference between PHP 5.0.2 and PHP 5.0.3

Details

Submitted2005-01-13 19:10 UTC
Fromruempler at topconcepts dot de
StatusWont fix
PackageHTML_QuickForm
PHP Version3.2.4pl1
OSirrelevant
Roadmaps(Not assigned)

Comments

[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.

[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 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()? ;)