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

Where?

Details

Submitted2005-08-26 16:43 UTC
Frompear at david dot endeavorcomputing dot com
StatusWont fix
PackageHTML_QuickForm
PHP Version5.0.4
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-08-26 16:43 UTC] pear at david dot endeavorcomputing dot com

Description:
------------
HTML entities use a OO shortcutting method to push their HTML, which destroys proper recursive rendering. This is very bad when putting HTML elements into group objects. The HTML all appears before the group's template even begins.

I saw other bug reports related to the OO shortcircuit, but not this specific problem.

Test script:
---------------
I traced the problem to this hunk of code in HTML/QuickForm/html.php:

function accept(&$renderer)
{
$renderer->renderHtml($this);
}

My sort-of fix is this:

function accept(&$renderer)
{
if ($renderer->_inGroup) {
$renderer->renderElement($this);
} else {
$renderer->renderHtml($this);
}
}

Unfortunately, my fix continues to violate OO principles by accessing a private data member (easily fixed with an accessor function) and using the shortcut method for main-form rendering. However, this fix does behave intuitively and should work with any existing code that doesn't actually use the HTML-in-group rendering error.

Expected result:
----------------
HTML printing in proper order in a group.

Actual result:
--------------
HTML elements come first in order, then the rest of the group members follow.

[2005-08-30 12:18 UTC] pear at david dot endeavorcomputing dot com

In that case, the documentation should make the depreciation more clear. The only thing it says right now is that the HTML element is intended for only the default renderer.

[2005-09-08 18:45 UTC] phppear at boonedocks dot net

Another request to update the documentation. I just wasted an hour discovering this today.