-
-
Notifications
You must be signed in to change notification settings - Fork 947
Incorrect number of sscanf placeholders detected (again) #10260
Description
Bug report
I found another case regarding #64 which has been solved in 2017, so I'll copy the description there:
sscanf has an "additional" way of specifying strings using regex-like character classes. It's handy when parsing strings with non-space separators. Not all these character classes are not correctly detected by PHPStan.
sscanf call like the following one throws Call to sscanf contains 1 placeholder, 3 values given.
sscanf('appletone_day_1', '%*[a-z]_day%s', $day_number);but it's actually a correct sscanf call, see https://3v4l.org/PNEok (also explains the character classes thing)
Code snippet that reproduces the problem
Expected output
No issue should be reported.
Did PHPStan help you today? Did it make you happy in any way?
Yes! It is a really great and interesting tool I'm excited about playing with when testing my code. It detects overlooked bugs like undefined variables and points to dead/unused code which we happily remove after.