Fixed Bad format specifier in XF\Error


Well-known member
Affected version
Line 285 of src/XF/Error.php:
$args[] = sprintf('%.*G', $arg);

* isn't a valid precision value. In PHP 7.4.11, this is silently ignored, and the result is the string "G". In PHP 8.0 RC2, this results in an exception.
$ php7.4 -r 'printf("%.*G\n", 0.1 * 10);'

$ php8.0 -r 'printf("%.*G\n", 0.1 * 10);'
PHP Fatal error:  Uncaught ValueError: Precision must be an integer in Command line code:1
Stack trace:
#0 Command line code(1): printf()
#1 {main}
  thrown in Command line code on line 1

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.2).

Change log:
Fix invalid format specifier in error trace argument builder
There may be a delay before changes are rolled out to the XenForo Community.