From dab657bd0b3e0d918e09096fe1fe1310466abfb5 Mon Sep 17 00:00:00 2001 From: Gert Vrebos Date: Tue, 14 Aug 2012 16:57:45 +0300 Subject: [PATCH] [Form] Fixed undefined index in writeProperty when saving value arrays When removing an item from an array and the previous value contains more than one identical copy of that item, the second unset fails with undefined index. --- src/Symfony/Component/Form/Util/PropertyPath.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Util/PropertyPath.php b/src/Symfony/Component/Form/Util/PropertyPath.php index 482d7ebc62f45..3188fc718ada2 100644 --- a/src/Symfony/Component/Form/Util/PropertyPath.php +++ b/src/Symfony/Component/Form/Util/PropertyPath.php @@ -510,7 +510,7 @@ private function writeProperty(&$objectOrArray, $property, $singular, $isIndex, if (is_array($previousValue) || $previousValue instanceof Traversable) { foreach ($previousValue as $previousItem) { - foreach ($value as $key => $item) { + foreach ($itemsToAdd as $key => $item) { if ($item === $previousItem) { // Item found, don't add unset($itemsToAdd[$key]);