StandardVariableProvider type issue
https://github.com/TYPO3/Fluid/blob/ae2d3d7ac201046275418c876fb82b63759678b1/src/Core/Variables/StandardVariableProvider.php#L261
$this->getByPath can be null leading to the following exception in TYPO3 v12 using PHP 8.1
#1476107295 TYPO3\CMS\Core\Error\Exception PHP Runtime Deprecation Notice: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in vendor/typo3fluid/fluid/src/Core/Variables/StandardVariableProvider.php line 261
Can be reproduced by using a sub-reference to a variable that is not defined in a Fluid template, e.g. {{someUndefinedVariable}}
While at it, the following should be fixed as well:
https://github.com/TYPO3/Fluid/blob/ae2d3d7ac201046275418c876fb82b63759678b1/src/Core/Variables/StandardVariableProvider.php#L258
- preg_match_all('/(\{.*\})/', $propertyPath, $matches);
+ preg_match_all('/(\{[^}]*\})/', $propertyPath, $matches);
which fixes {foo.{bar}.{baz}}
@helhum Can you create a separate ticket for this? Thanks.
Can be reproduced by using a sub-reference to a variable that is not defined in a Fluid template, e.g.
{{someUndefinedVariable}}
Any workarounds? I have this: {settings.maxImageWidth.colPos.{colPos}.full}
Btw - this is also the case for TYPO3 v11 and PHP 8.1
Fixed the deprecation warning now. For the multi-sub-reference isssue Helmut mentioned: This is covered by #353 already, and we have https://github.com/TYPO3/Fluid/pull/663 and https://github.com/smoebody/Fluid/commit/51b0a926a7991c0353f3fc80df054bde10881c44 which both try to fix this. Let's continue with #353 for this.