[BUGFIX] Don't clone ContentObject in ConfigurationManager
authorBastian Waidelich <bastian@typo3.org>
Fri, 9 Sep 2011 18:27:00 +0000 (20:27 +0200)
committerBastian Waidelich <bastian@typo3.org>
Fri, 9 Sep 2011 18:27:00 +0000 (20:27 +0200)
This reverts Ia3271303e571931b1d9c45e37f2b1455987e1ce0 which
introduced a regression:
Cloning the cObject will break non-cacheable actions in
otherwise cacheable Plugins because convertToUserIntObject()
has to be called on the current cObject.

Change-Id: I831fa9dbe58c572e40b7c89e5b8ff32e9f935b78
Related: #12332

typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php
typo3/sysext/extbase/Tests/Unit/Configuration/AbstractConfigurationManagerTest.php

index d45f4b3..6c6db02 100644 (file)
@@ -105,7 +105,7 @@ abstract class Tx_Extbase_Configuration_AbstractConfigurationManager implements
         */
        public function getContentObject() {
                if ($this->contentObject !== NULL) {
-                       return clone $this->contentObject;
+                       return $this->contentObject;
                }
        }
 
index 27757ea..e0c0794 100644 (file)
@@ -526,11 +526,10 @@ class Tx_Extbase_Tests_Unit_Configuration_AbstractConfigurationManagerTest exten
        /**
         * @test
         */
-       public function getContentObjectReturnsACloneOfTheContentObject() {
+       public function getContentObjectTheCurrentContentObject() {
                $mockContentObject = $this->getMock('tslib_cObj');
                $this->abstractConfigurationManager->setContentObject($mockContentObject);
-               $this->assertType('tslib_cObj', $mockContentObject);
-               $this->assertNotSame($this->abstractConfigurationManager->getContentObject(), $mockContentObject);
+               $this->assertSame($this->abstractConfigurationManager->getContentObject(), $mockContentObject);
        }
 }
 ?>
\ No newline at end of file