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

Bug #209 ObjectFlexy renderer breaks on groups with '_' in name
Submitted: 2003-11-07 10:45 UTC
From: avb Assigned: mixtli
Status: Closed Package: HTML_QuickForm
PHP Version: 4.3.3 OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2003-11-07 10:45 UTC] avb
Description: ------------ If the group name contains underscores, ObjectFlexy incorrectly sets object properties corresponding to element names. The same problem was recently found and fixed in ArraySmarty. Reproduce code: --------------- require_once 'HTML/QuickForm.php'; require_once 'HTML/Template/Flexy.php'; require_once 'HTML/QuickForm/Renderer/ObjectFlexy.php'; $form =& new HTML_QuickForm(); $grp['first'] =& $form->createElement('text', 'first'); $grp['second'] =& $form->createElement('text', 'second'); $form->addGroup($grp, 'the_group', 'ObjectFlexy bug:'); $template =& new HTML_Template_Flexy(); $renderer =& new HTML_QuickForm_Renderer_ObjectFlexy($template); $form->accept($renderer); var_dump($renderer->toObject()); Expected result: ---------------- object(quickformflexyform)(9) { ["frozen"]=> bool(false) ["javascript"]=> string(0) "" ["attributes"]=> string(62) " action="G:\work\qf-flexy-bug.php" method="post" name="" id=""" ["requirednote"]=> string(111) "<span style="font-size:80%; color:#ff0000;">*</span><span style="font-size:80%;"> denotes required field</span>" ["hidden"]=> string(0) "" ["errors"]=> object(stdClass)(0) { } ["elements"]=> NULL ["sections"]=> NULL ["the_group"]=> object(quickformflexyelement)(12) { ["name"]=> string(5) "group" ["value"]=> NULL ["type"]=> string(5) "group" ["frozen"]=> bool(false) ["label"]=> string(16) "ObjectFlexy bug:" ["required"]=> bool(false) ["error"]=> NULL ["style"]=> NULL ["html"]=> string(89) "<input name="group[first]" type="text" /> <input name="group[second]" type="text" />" ["separator"]=> NULL ["first"]=> object(quickformflexyelement)(11) { ["name"]=> string(12) "group[first]" ["value"]=> NULL ["type"]=> string(4) "text" ["frozen"]=> bool(false) ["label"]=> string(0) "" ["required"]=> bool(false) ["error"]=> NULL ["style"]=> NULL ["html"]=> string(41) "<input name="group[first]" type="text" />" ["separator"]=> NULL ["elements"]=> NULL } ["second"]=> object(quickformflexyelement)(11) { ["name"]=> string(13) "group[second]" ["value"]=> NULL ["type"]=> string(4) "text" ["frozen"]=> bool(false) ["label"]=> string(0) "" ["required"]=> bool(false) ["error"]=> NULL ["style"]=> NULL ["html"]=> string(42) "<input name="group[second]" type="text" />" ["separator"]=> NULL ["elements"]=> NULL } } } Actual result: -------------- object(quickformflexyform)(9) { ["frozen"]=> bool(false) ["javascript"]=> string(0) "" ["attributes"]=> string(62) " action="G:\work\qf-flexy-bug.php" method="post" name="" id=""" ["requirednote"]=> string(111) "<span style="font-size:80%; color:#ff0000;">*</span><span style="font-size:80%;"> denotes required field</span>" ["hidden"]=> string(0) "" ["errors"]=> object(stdClass)(0) { } ["elements"]=> NULL ["sections"]=> NULL ["the_group"]=> object(quickformflexyelement)(11) { ["name"]=> string(9) "the_group" ["value"]=> NULL ["type"]=> string(5) "group" ["frozen"]=> bool(false) ["label"]=> string(16) "ObjectFlexy bug:" ["required"]=> bool(false) ["error"]=> NULL ["style"]=> NULL ["html"]=> string(97) "<input name="the_group[first]" type="text" /> <input name="the_group[second]" type="text" />" ["separator"]=> NULL ["group"]=> object(quickformflexyelement)(11) { ["name"]=> string(17) "the_group[second]" ["value"]=> NULL ["type"]=> string(4) "text" ["frozen"]=> bool(false) ["label"]=> string(0) "" ["required"]=> bool(false) ["error"]=> NULL ["style"]=> NULL ["html"]=> string(46) "<input name="the_group[second]" type="text" />" ["separator"]=> NULL ["elements"]=> NULL } } }

Comments

 [2003-11-07 10:49 UTC] avb
Assigning to maintainer. And yes, the element's name in the expected result should be 'the_group' everywhere. Sorry for that.
 [2004-01-03 12:52 UTC] jacques
Hi, I've quickly taken a look at this on my development FreeBSD box. I cannot replicate this error on this box. Please check that you have the following versions of HTML_QuickForm version 3.2 and HTML_Template_Flexy 0.6.1 installed. Thank you.
 [2004-01-03 14:05 UTC] avb
Tested with current CVS of QuickForm and Flexy 0.6.1, the bug is still here. Look closely at the output, instead of having two elements in a group object as properties with their names, we have only the second element with a bogus property name 'group'.
 [2004-01-03 17:57 UTC] avb
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.