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

Bug #8414 eval errors in QuickForm/element.php
Submitted: 2006-08-10 20:13 UTC
From: kjh at flyballdogs dot com Assigned:
Status: Duplicate Package: HTML_QuickForm (version 3.2.6)
PHP Version: 5.1.4 OS: Fedora Core 5
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 40 + 14 = ?

 
 [2006-08-10 20:13 UTC] kjh at flyballdogs dot com (Kathryn Hogg)
Description: ------------ I have a form where I am creating elements with names that may contain single quotes and these elements are part of a group. $elements[] =& $this->createElement('checkbox', "O'Brien", null, "Dan O'Brien", $attrs); $this->addGroup($elements, 'roster', null, "<br>\n"); The addGroup call creates an error in the eval statement in element.php _findValue. Its trying to eval a string that contains roster[O'Brien] for example. I fixed this by changing $myVar = "['" . str_replace(array(']', '['), array('', "']['"), $elementName) . "']"; to $myVar = "['" . str_replace(array(']', '['), array('', "']['"), addslashes($elementName)) . "']"; _prepareValue has a similar problem and I changed it from $myIndex = "['" . str_replace(array(']', '['), array('', "']['"), $name) . "']"; to $myIndex = "['" . str_replace(array(']', '['), array('', "']['"), addslashes($name)) . "']"; and everything appears to work correctly now.

Comments

 [2006-10-06 15:50 UTC] avb (Alexey Borzov)
This is a duplicate of bug #8123.