Skip to content
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

false positives with sprintf with sign specifier #75

Closed
VasekPurchart opened this issue Jan 10, 2017 · 2 comments
Closed

false positives with sprintf with sign specifier #75

VasekPurchart opened this issue Jan 10, 2017 · 2 comments

Comments

@VasekPurchart
Copy link
Contributor

VasekPurchart commented Jan 10, 2017

I think the sign specifier throws off checking of the number of placeholders:

<?php

var_dump(sprintf('%+02d', 1));

Tested on 0.5.2:

 ------ --------------------------------------------------------- 
  Line   bootstrap.php                                            
 ------ --------------------------------------------------------- 
  3      Call to sprintf contains 0 placeholders, 1 value given.  
 ------ ---------------------------------------------------------

The sign specifier is part of the formatting options though, see the documentation:

An optional sign specifier that forces a sign (- or +) to be used on a number. By default, only the - sign is used on a number if it's negative. This specifier forces positive numbers to have the + sign attached as well.

@VasekPurchart VasekPurchart changed the title false positives with sprintf with sign specifier false positives with sprintf with sign specifier Jan 10, 2017
@ondrejmirtes
Copy link
Member

Thanks!

@VasekPurchart
Copy link
Contributor Author

Fix verified on master, thanks :)

@lock lock bot locked as resolved and limited conversation to collaborators Dec 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants