PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #6354

Array to String conversion error

Details

Submitted2005-12-28 08:38 UTC
Frommosh at tobt dot de
StatusBogus
PackageHTML_QuickForm
PHP Version4.3.10
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-12-28 08:38 UTC] mosh at tobt dot de

Description:
------------
This error only occurs using PHP4 on a system with notices set to on in error_reporting. In line 39 of file HTML/QuickForm/Rule/Required.php (QF version 3.2.5) there's a (string)type-cast which causes a notice (Array to string conversion)

I suggest a change from

if ((string)$value == '') {

to

if (implode('', (array)$value) == '') {

[2005-12-28 18:38 UTC] mosh at tobt dot de

No, the notice occurs after submitting the form for instance when using a select-box with parameter multiple. Then an array is returned which causes the notice in php4 (in php5 everything works fine). So the error is not in my code! I know it's just a notice, but in an E_ALL environment the script is aborted. And with a simple workaround the script would be E_ALL-safe.