Skip to content

sprintf 'h' and 'H' placeholders not recognised (new in PHP 8) #4717

@sjbartley

Description

@sjbartley

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.'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions