Issue Bug Closed

#76314Fluid: StandaloneView: RootNode could not be converted to string

Stefan Froemken 05/27/16, 00:04 updated 09/02/16, 23:51

Description

Hello Core-Team,

Currently I get following error when using the StandaloneView of Fluid:

PHP Catchable Fatal Error: Object of class TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode could not be converted to string in /Applications/MAMP/htdocs/typo3_src/vendor/typo3fluid/fluid/src/Core/Compiler/TemplateCompiler.php line 175

<f:layout name="{layoutPath}" />

<f:section name="main">
...
</f:section>
if (
  GeneralUtility::compat_version('7.6') ||
  GeneralUtility::compat_version('8.0')
) {
  $this->view->assign('layoutPath', 'Typo3_76');
} else {
  $this->view->assign('layoutPath', 'Typo3_62');
}

The correct layoutPath will be assigned in TYPO3 6.2, 7.6 and 8.2-dev.

The problem is following part in TemplateCompiler.php

$templateCode = sprintf(
  $templateCode,
  $classDefinition,
  '$renderingContext->getVariableProvider()->get(\'layoutName\')',
  $parsingState->getVariableContainer()->get('layoutName'),
  ($parsingState->hasLayout() ? 'TRUE' : 'FALSE'),
  var_export($this->renderingContext->getViewHelperResolver()->getNamespaces(), TRUE),
  $generatedRenderFunctions
);
$this->renderingContext->getCache()->set($identifier, $templateCode);

This line:
$parsingState->getVariableContainer()->get(‘layoutName’),

will return an object of type RootNode which can’t be converted to string…which is needed by var_export.

Stefan

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.