Re: QuickForm bug and patch, on removeElement()
| From: | Bertrand Mansion | Date: | Wed, 16 Jul 2003 09:39:09 +0000 |
| Subject: | Re: QuickForm bug and patch, on removeElement() | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-18289@lists.php.net to get a copy of this message | ||
<wolfram@visionp.de> wrote :
> now i got the right patch, it is actually much easier.
> the problem was just when a new element was added, that the
> _elementIndex was built using count, which is not right when a gap was
> created, so we have to use the real index used.
> this patch does it finally :-)
>
> RCS file: /repository/pear/HTML_QuickForm/QuickForm.php,v
> retrieving revision 1.108
> diff -u -r1.108 QuickForm.php
> --- QuickForm.php 28 Jun 2003 10:58:49 -0000 1.108
> +++ QuickForm.php 16 Jul 2003 09:27:29 -0000
> @@ -591,7 +591,8 @@
> }
> } else {
> $this->_elements[] =& $elementObject;
> - $this->_elementIndex[$elementName] =
> count($this->_elements) - 1;
> + $revKeys = array_reverse(array_keys($this->_elements));
> + $this->_elementIndex[$elementName] = $revKeys[0];
> }
>
> return $elementObject;
Hi Wolfram,
Thanks for the patch, I'll apply it soon and make a new release of QuickForm
as there are lots of other things we added.
Bertrand