[+BUGFIX] Extbase (Persistence): Added check for array before calling foreach. Thanks...
authorJochen Rau <j.rau@web.de>
Wed, 20 Jan 2010 10:45:17 +0000 (10:45 +0000)
committerJochen Rau <j.rau@web.de>
Wed, 20 Jan 2010 10:45:17 +0000 (10:45 +0000)
typo3/sysext/extbase/Classes/Persistence/Backend.php

index 779ffab..7e7d12e 100644 (file)
@@ -366,9 +366,11 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
                                if ($object->_isNew() || $object->_isDirty($propertyName)) {
                                        $this->persistObjectStorage($propertyValue, $object, $propertyName, $queue, $row);
                                }
-                               foreach ($propertyValue as $containedObject) {
-                                       if ($containedObject instanceof Tx_Extbase_DomainObject_AbstractEntity) {
-                                               $queue[] = $containedObject;
+                               if (is_array($propertyValue)) {
+                                       foreach ($propertyValue as $containedObject) {
+                                               if ($containedObject instanceof Tx_Extbase_DomainObject_AbstractEntity) {
+                                                       $queue[] = $containedObject;
+                                               }
                                        }
                                }
                        } elseif ($propertyValue instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {