PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_QuickForm » Bug #8305

PHP-Warning with empty hiddenselect

Details

Submitted2006-07-27 07:37 UTC
Fromarne dot bippes at brandao dot de
Assignedavb
StatusClosed
PackageHTML_QuickForm
PHP VersionIrrelevant
OSirrelevant
Roadmaps(Not assigned)

Comments

[2006-07-27 07:37 UTC] arne dot bippes at brandao dot de

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