Twig
Twig copied to clipboard
PHP 8 and wrong input of 'format' filter breaks template rendering
Hi, I'm using Twig 2.14.4 with PHP 8.0.3 in CMS.
Template snippet: 'You have % z new comments' | format( newCommentCount )
If user has error in input of format
filter template rendering ends with ValueError: Unknown format specifier "z"
exception.
PHP prior 8.0 only issued warning, returned false
and rendering of template continued.
Possible solution would be to wrap sprintf
call to try/catch
block to prevent end of template rendering.
To me, the actual fix is to pass valid values.