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

Bug #8414 eval errors in QuickForm/element.php
Submitted: 2006-08-10 15:13 UTC Modified: 2006-10-06 10:50 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  


 [2006-08-10 15: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 10:50 UTC] avb (Alexey Borzov)
This is a duplicate of bug #8123.