Do not break on PHP 8.0 and above
DanielSiepmann opened this issue · 2 comments
The Symfony Expression will break of no user agent is provided.
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476107295: PHP Warning: Undefined array key 0 in /vendor/symfony/expression-language/Node/GetAttrNode.php line 97 | TYPO3\CMS\Core\Error\Exception thrown in file /typo3/sysext/core/Classes/Error/ErrorHandler.php in line 137. Requested URL: https://example.com
PR #80 already tried to fix this. I would say this was not the best idea. We should use TYPO3 behaviour and provide a traverse
method for arrays.
See: https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Conditions/Index.html#traverse
That would involve a new dedicated class for evaluating the rules.
That one could ask a factory to build the expression, adding such features.
That expression is then used as usual.
We also should have a further look on how to handle errors instead of using @
as dirty workaround. We should wrap the whole evaluation and fallback to false
do not track. And add a log entry with incoming data, rule and error.
That would allow other developers to replace the factory and add further provider.
Related TYPO3 Issue: https://forge.typo3.org/issues/95781
Should be solved now, will test new version on my own site until I'll tag a new version.