Commit d1bf1a06 authored by Claus Due's avatar Claus Due Committed by Andreas Fernandez
Browse files

[BUGFIX] Fix regression in RenderingContext::__construct w/o View

This patch fixes a regression after https://review.typo3.org/#/c/50590/
which unfortunately caused some custom implementations
(e.g. static info tables extension) to fail with a PHP fatal error.

Change-Id: I61f7327208e20a973471fbfed02fe83c00d3995c
Resolves: #78746
Releases: master
Reviewed-on: https://review.typo3.org/50708

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Riccardo De Contardi's avatarRiccardo De Contardi <erredeco@gmail.com>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
parent 32e7a14b
......@@ -24,10 +24,13 @@ use TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\Expression\LegacyNamespaceExpressionN
use TYPO3\CMS\Fluid\Core\Variables\CmsVariableProvider;
use TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperResolver;
use TYPO3\CMS\Fluid\View\TemplatePaths;
use TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler;
use TYPO3Fluid\Fluid\Core\Parser\Configuration;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\CastingExpressionNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\MathExpressionNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\TernaryExpressionNode;
use TYPO3Fluid\Fluid\Core\Parser\TemplateParser;
use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInvoker;
use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer;
use TYPO3Fluid\Fluid\View\ViewInterface;
......@@ -117,12 +120,21 @@ class RenderingContext extends \TYPO3Fluid\Fluid\Core\Rendering\RenderingContext
*/
public function __construct(ViewInterface $view = null)
{
parent::__construct($view);
if ($view !== null) {
// Note: if $view is received here this indicates internal framework instancing
// and it is safe to call the parent constructor. Custom, non-view-providing
// usages will only perform the initialisation below (which is sufficient mind you!)
parent::__construct($view);
} else {
// Reproduced partial initialisation from parent::__construct; minus the custom
// implementations we attach below.
$this->setTemplateParser(new TemplateParser());
$this->setTemplateCompiler(new TemplateCompiler());
$this->setViewHelperInvoker(new ViewHelperInvoker());
$this->setViewHelperVariableContainer(new ViewHelperVariableContainer());
}
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
if ($view) {
$this->view = $view;
}
$this->setTemplatePaths($objectManager->get(TemplatePaths::class));
$this->setViewHelperResolver($objectManager->get(ViewHelperResolver::class));
$this->setVariableProvider($objectManager->get(CmsVariableProvider::class));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment