Fixed Bad format specifier in XF\Error

PaulB

Well-known member
Affected version
2.2.1
Line 285 of src/XF/Error.php:
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.
Code:
$ php7.4 -r 'printf("%.*G\n", 0.1 * 10);'
G

$ 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
 
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.
 
Back
Top Bottom