New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sprintf 'h' and 'H' placeholders not recognised (new in PHP 8) #4717
Comments
This bug report is missing a link to reproduction on phpstan.org. It will most likely be closed after manual review. |
@sjbartley After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
+PHP 8.0
+==========
+
+No errors
+
+PHP 7.1 – 7.4 (1 error)
+==========
+
5: Call to sprintf contains 1 placeholder, 2 values given. Full reportPHP 8.0No errors PHP 7.1 – 7.4 (1 error)
|
@sjbartley After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
+PHP 8.0
+==========
+
+No errors
+
+PHP 7.1 – 7.4 (1 error)
+==========
+
5: Call to sprintf contains 1 placeholder, 2 values given. Full reportPHP 8.0No errors PHP 7.1 – 7.4 (1 error)
|
Fixed: phpstan/phpstan-src@0cbbfba |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
The new (PHP 8) sprintf() placeholders %h and %H are not recognised.
Code snippet that reproduces the problem
$f = 4.0/3;
$s = 'Bug';
echo sprintf('%s qty = %h', $s, $f);
See https://phpstan.org/r/6bb27f99-6ae5-4e08-831a-f91b995b20cf#
Expected output
The above snippet outputs 'Bug qty = 1.33333'.
PhpStan should not raise any errors to do with the sprintf() expression, but currently reports 'Call to sprintf contains 1 placeholder, 2 values given.'
The text was updated successfully, but these errors were encountered: