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 #6149

addElement('hidden', ...) fails if no other input elements have been added

Details

Submitted2005-12-05 02:18 UTC
Frommikejestes at gmail dot com
StatusBogus
PackageHTML_QuickForm
PHP Version5.0.5
OSFreeBSD 6.0
Roadmaps(Not assigned)

Comments

[2005-12-05 02:18 UTC] mikejestes at gmail dot com

Description:
------------
Inserting a 'hidden' form type before any other input types is broken.

Tested with HTML_QuickForm 3.2.5

Test script:
---------------
################
# Works:

require_once ('HTML/QuickForm.php');

$fileform =& new HTML_QuickForm('fileform');

$fileform->addElement('header', null, 'Upload Picture:');
$fileform->addElement('text', 'image', 'Image:');
$fileform->addElement('hidden', 'id', '1');

#################
# breaks:

require_once ('HTML/QuickForm.php');

$fileform =& new HTML_QuickForm('fileform');

$fileform->addElement('header', null, 'Upload Picture:');
$fileform->addElement('hidden', 'id', '1');
$fileform->addElement('text', 'image', 'Image:');

Expected result:
----------------
A working form.

Actual result:
--------------
Fatal error: Call to undefined method HTML_QuickForm_hidden::HTML_QuickForm_element() in /usr/local/www/mikejestes/cvs/sole/shared/admin/includes/PEAR/HTML/QuickForm/input.php on line 50

[2005-12-05 06:26 UTC] mikejestes at gmail dot com

Yes, the pear apc was enabled. Disabling the extension fixes the issue. After more testing, it seems that changing the order of addElement() calls triggers the issue.

Seems like more of a bug for APC, unless it's possible to work around this in the QuickForm code.