[BUGFIX] Infinite loop with circular relations 71/40471/4
authorFelix Oertel <foertel@devbutze.de>
Fri, 19 Jun 2015 13:58:04 +0000 (15:58 +0200)
committerNicole Cordes <typo3@cordes.co>
Sun, 21 Jun 2015 11:05:33 +0000 (13:05 +0200)
When resolving circular relations, extbase fails with an
infinite loop because the DataMapper waits for all sub-
objects to be mapped before registering them to the session.
The sub-objects can thus not find the parent object in the
session and the loop begins.

Resolves: #67630
Related: #66429
Releases: master
Change-Id: Ie20e2690323a00d8f54f3af5ce2fce87715f4247
Reviewed-on: http://review.typo3.org/40471
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php

index d884f74..9c507cd 100644 (file)
@@ -131,9 +131,9 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface {
                        $object = $this->persistenceSession->getObjectByIdentifier($row['uid'], $className);
                } else {
                        $object = $this->createEmptyObject($className);
+                       $this->persistenceSession->registerObject($object, $row['uid']);
                        $this->thawProperties($object, $row);
                        $object->_memorizeCleanState();
-                       $this->persistenceSession->registerObject($object, $row['uid']);
                        $this->persistenceSession->registerReconstitutedEntity($object);
                }
                return $object;