Skip to content

Fix false InvalidArgument for sprintf precision placeholders#11729

Open
eyupcanakman wants to merge 1 commit intovimeo:6.xfrom
eyupcanakman:fix/sprintf-precision-11721
Open

Fix false InvalidArgument for sprintf precision placeholders#11729
eyupcanakman wants to merge 1 commit intovimeo:6.xfrom
eyupcanakman:fix/sprintf-precision-11721

Conversation

@eyupcanakman
Copy link
Contributor

Fix #11721

Psalm validates some sprintf/printf formats by calling them with dummy values. For .* precision placeholders that used empty strings, PHP 8 raises a false ValueError and Psalm reported InvalidArgument.

Validate complex * width and precision placeholders with integer dummies before falling back to the generic return type. Add regressions for %.*f, positional variants, and related arity errors.

Fix vimeo#11721

Psalm validates some sprintf/printf formats by calling them with dummy values. For .* precision placeholders that used empty strings, PHP 8 raises a false ValueError and Psalm reported InvalidArgument.

Validate complex * width and precision placeholders with integer dummies before falling back to the generic return type. Add regressions for %.*f, positional variants, and related arity errors.
eyupcanakman added a commit to eyupcanakman/endtoend-test-collections that referenced this pull request Mar 15, 2026
Update psalm-baseline.xml for vimeo/psalm#11729.

The sprintf precision placeholder fix removes several Missing* baseline entries in this fixture project, so the baseline needs to be regenerated with the current Psalm branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sprintf precision parameter type misidentification

1 participant