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

Bug #338 Unsupported Operands syntax error in class QuickForm
Submitted: 2003-12-02 19:15 UTC
From: mfriedman at symcor dot com Assigned:
Status: Bogus Package: HTML_QuickForm
PHP Version: Irrelevant OS: Linux
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 : 26 + 23 = ?

 
 [2003-12-02 19:15 UTC] mfriedman at symcor dot com
Description: ------------ There was another error report about this but I do not believe the issue has been properly dealt with. The problem exists because the operator being used does not relate correctly to the var type. The class declares $this->_errors as an array and so at least for consistency it should be treated as such in a consistent way. Thus the operator used to append to the $this->_errors array should be [] and not +=. Doing otherwise is also confusing because it breaks the way the other validation methods are written - it doesn't seem consistent to me. Here is my report: On line 1290 of QuickForm.php there is an error which causes an unsupported operands error in php. line 1290: $this->_errors += $res; The += operator is incorrectly used here - it is a string operator. $this->_errors is an array so the line should read instead: line 1290: $this->_errors[$elementName] = $res; This is part of the validate() method. Reproduce code: --------------- // process the global rules now foreach ($this->_formRules as $rule) { if (true !== ($res = call_user_func($rule, $this->_submitValues, $this->_submitFiles))) { $this->_errors += $res; } } Expected result: ---------------- There should be no error generated by php. Actual result: -------------- Fatal error: Unsupported operand types in /home/client/php/PEAR/HTML/QuickForm.php on line 1290

Comments

 [2003-12-02 19:43 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!