In PHP8 conversion of non-numeric string to number is considered fatal error.
Following example will throw a fatal error:
file.php
$twig = new Environment(new FilesystemLoader(__DIR__));
$twig->display('Page.twig', ['test_var' => 'string']);
template.html.twig
Result:
Fatal error: Uncaught Error: Unsupported operand types: string + int
in /vendor/twig/twig/src/Environment.php(358) : eval()'d code on line 37
In PHP8 conversion of non-numeric string to number is considered fatal error.
Following example will throw a fatal error:
file.php
template.html.twig
{{ test_var + 1 }}Result: