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

Bug #8305 PHP-Warning with empty hiddenselect
Submitted: 2006-07-27 07:37 UTC
From: arne dot bippes at brandao dot de Assigned: avb
Status: Closed Package: HTML_QuickForm (version 3.2.6)
PHP Version: Irrelevant OS: irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2006-07-27 07:37 UTC] arne dot bippes at brandao dot de (Arne Bippes)
Description: ------------ HTML_QuickForm_hiddenselect throws a PHP-Warning in function toHtml()if $this->_values is empty. (e.g. not calling loadDbResult() with values ) A quick patch would be to check in hiddenselect.php if $this->_values is an array otherwise return empty string: 77: ... 78: $strHtml = ''; 79: 80: /** Patch start */ 81: if (! is_array($this->_values)) { 82: return $strHtml; 83: } 84: /** Patch end */ 85: 86: foreach ($this->_values as $key => $val) { ... Expected result: ---------------- No Warning Actual result: -------------- Warning: Invalid argument supplied for foreach() in /pear/HTML/QuickForm/hiddenselect.php on line 80

Comments

 [2006-10-06 16:01 UTC] avb (Alexey Borzov)
For some strange reason $_values property in HTML_QuickForm_select is initialized to null rather than array(). Should check whether this can be changed.
 [2006-10-07 21:19 UTC] avb (Alexey Borzov)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. -- Dedcided against touching select.php, applied a variant of proposed patch. Thanks!