From fc4087cb80005844dab49871211153afd28bc2a6 Mon Sep 17 00:00:00 2001 From: Gert Vrebos Date: Fri, 10 Aug 2012 11:47:03 +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. --- Util/PropertyPath.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Util/PropertyPath.php b/Util/PropertyPath.php index 482d7ebc62..3188fc718a 100644 --- a/Util/PropertyPath.php +++ b/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]);