MDL-29147 Quickform fixed insertElementBefore to ignore duplicate unnamed elements

This commit is contained in:
Davo Smith
2012-03-14 11:54:42 +13:00
committed by Sam Hemelryk
parent 999e6901c8
commit da9cfb9630
+4 -2
View File
@@ -676,8 +676,10 @@ class HTML_QuickForm extends HTML_Common {
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]);
}