Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-29147 Quickform fixed insertElementBefore to ignore duplicate unn…

…amed elements
  • Loading branch information...
commit 9086379bb761dd7d44d5741b5d4dae60cf5b61cb 1 parent 40ba373
Davo Smith davosmith authored samhemelryk committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/pear/HTML/QuickForm.php
6 lib/pear/HTML/QuickForm.php
View
@@ -676,8 +676,10 @@ function &insertElementBefore(&$element, $nameAfter)
if ($this->_elementIndex[$currentName] == $i) {
$this->_elementIndex[$currentName] = $i + 1;
} else {
- $dupIdx = array_search($i, $this->_duplicateIndex[$currentName]);
- $this->_duplicateIndex[$currentName][$dupIdx] = $i + 1;
+ if (!empty($currentName)) {
+ $dupIdx = array_search($i, $this->_duplicateIndex[$currentName]);
+ $this->_duplicateIndex[$currentName][$dupIdx] = $i + 1;
+ }
}
unset($this->_elements[$i]);
}
Please sign in to comment.
Something went wrong with that request. Please try again.