Skip to content

Possible error - Call to printf contains X placeholders, Y values given #9072

@ondrejmirtes

Description

@ondrejmirtes

Discussed in #9069

Originally posted by pmjbailly March 22, 2023
Hi All,

I'm migrating a project from php 5 to 8 thanks to PhpStan, but it seems to be an issue with the placeholders in printf/sprintf functions recognised from PhpStan.

In the project, there is a lot of printf / sprintf calls that contains %lu as a placeholder, but PhpStan doesn't seem to know it's a placeholder, so it's returning an error for each occurences.

So I'm questionning myself as to know if it's the normal behavior or not to throw an error on this placeholder.

https://phpstan.org/r/d554dd3f-caf1-493a-b90a-49361d6aba3a

PS: I couldn't find a similar question on the web, nor a clue as to why this placeholder is different, if it's a duplicate I'm sorry.

Thanks folks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions