QuickForm bug?
| From: | Daniel C. | Date: | Tue, 01 Mar 2005 21:46:42 +0000 |
| Subject: | QuickForm bug? | ||
| Groups: | php.pear.dev php.pear.general | ||
| Request: | Send a blank email to pear-dev+get-36444@lists.php.net to get a copy of this message | ||
I just submitted a bug, it's number 3653, about setValue in QuickForm.
Approximately how long is the turnaround in bug-addressing time? How
much help am I likely to get by sending this here as opposed to just
waiting for it to be addressed in due time?
For the curious, here's an explanation of the bug, along with code.
In short, when I call setValue on a checkbox object, the value element
in the object's _attributes array doesn't get changed from 1 to the
value passed to setValue.
The reason I'm really writing is because I'm not 100% certain that I'm
calling it the right way. I mean, it seems like it should be pretty
straightforward - setValue only takes a single argument, so it can't
be that hard to mess up. I've learned that I have a phenomenal
ability to screw up the simplest things though, so if someone could
look at the code below and tell me if I'm doing it right, I'd be much
obliged. This is just the bare bones, the actual code itself has much
more than this, but this is all of the code related to the problem.
I'm using PHP 4.3.10. The version of QuickForm.php that I have is
1.151, the version of HTML/Common.php that I have is 1.8, the version
of HTML/QuickForm/input.php I have it also 1.8.
<?php
$form = new HTML_QuickForm('creation');
$box = &$form->createElement('checkbox', $name, $display);
$box->setValue($checked_value);
$box->setChecked(FALSE);
$form->addElement($box);
?>
Changing $box = &$form->createElement(etc) to passing not by reference
doesn't affect anything, so far as I can tell, but passing by
reference is supposed to be the "right" way to do it, according to
someone in the #pear room. I can change the value (and this is the
workaround I'm currently using) like so:
$box->_attributes['value'] = $checked_value
but I think we can agree that this is an ugly kludge. I've also
traced the call to setValue through all of its respective inheritances
and whatnot, and a preliminary review of the code doesn't show
anything glaringly, obviously wrong. And finally, no I haven't been a
good little bug tester and tested this with various different
elements, different versions of QuickForm, different versions of PHP,
and so on. Just with checkboxes and the versions I stated above.
Thanks in advance for any help you guys can give,
Daniel