[TASK] Improve variable access in compiled templates
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / Core / Parser / SyntaxTree / ObjectAccessorNode.php
index 3bcf51a..ecc9ea4 100644 (file)
@@ -79,6 +79,9 @@ class ObjectAccessorNode extends \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\Abstrac
        static public function getPropertyPath($subject, $propertyPath, \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext) {
                $propertyPathSegments = explode('.', $propertyPath);
                foreach ($propertyPathSegments as $pathSegment) {
+                       if ($subject === NULL || is_scalar($subject)) {
+                               return NULL;
+                       }
                        $propertyExists = FALSE;
                        $propertyValue = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyInternal($subject, $pathSegment, FALSE, $propertyExists);
                        if ($propertyExists !== TRUE && (is_array($subject) || $subject instanceof \ArrayAccess) && isset($subject[$pathSegment])) {
@@ -93,5 +96,4 @@ class ObjectAccessorNode extends \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\Abstrac
                }
                return $subject;
        }
-
 }