[TASK] Inject TSFE object into ContentObjectRenderer 26/58026/2
authorBenni Mack <benni@typo3.org>
Fri, 24 Aug 2018 15:28:18 +0000 (17:28 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 25 Aug 2018 12:51:57 +0000 (14:51 +0200)
The class ContentObjectRenderer expects $typoScriptFrontendController
as first argument inside the constructor.

When creating cObj from within TypoScriptFrontendController, it is very valuable
to actually use the actual current object instead of doing the regular fallback
to $GLOBALS['TSFE'], to use this in proper recursions.

Resolves: #85968
Releases: master
Change-Id: I2238c8fc4d4d76f177b02630ed5627a3c9a7a060
Reviewed-on: https://review.typo3.org/58026
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 740ef25..e6ed34e 100644 (file)
@@ -3146,7 +3146,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         $this->calculateLinkVars();
         // Instantiate \TYPO3\CMS\Frontend\ContentObject to generate the correct target URL
         /** @var $cObj ContentObjectRenderer */
-        $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
+        $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class, $this);
         $parameter = $this->page['uid'];
         $type = GeneralUtility::_GET('type');
         if ($type && MathUtility::canBeInterpretedAsInteger($type)) {
@@ -4082,7 +4082,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
      */
     public function newCObj()
     {
-        $this->cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
+        $this->cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class, $this);
         $this->cObj->start($this->page, 'pages');
     }