Skip to content

Commit

Permalink
preserve numeric field names on prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
weyrick committed Jun 2, 2011
1 parent af5e879 commit 427fccd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/smSmartForm.inc
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ class SM_smartForm extends SM_object {
$newEnt = new SM_formEntity($varName, $title, $type, $req, $this, $tpt, $val, $fieldset);
if ($prepend) {
$pre[$varName] = $newEnt;
$this->entityList = array_merge($pre,(array)$this->entityList);
// NOTE we don't use array_merge here because numeric keys are renumbered, which is
// unacceptable since keys here are form field names
$this->entityList = $pre + (array)$this->entityList;
}
else {
$this->entityList[$varName] = $newEnt;
Expand Down

0 comments on commit 427fccd

Please sign in to comment.