MDL-29147 Quickform fixed insertElementBefore to ignore duplicate unnamed elements

This commit is contained in:
Davo Smith
2012-02-27 20:05:39 +00:00
parent c4a12afaf9
commit 9f9c794733
+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]);
}