vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.54k stars 659 forks source link

password_hash algo param can be string #3454

Closed iluuu1994 closed 3 years ago

iluuu1994 commented 4 years ago

I get an error on PHP 74 due to this line:

https://github.com/vimeo/psalm/blob/3416e333486e1202035a6620137e1c1c06730144/src/Psalm/Internal/CallMap_74_delta.php#L24

When I add string to the algo param it goes away. Not sure if this should be necessary, I do not fully understand what the 'new' and 'old' sections are for.

psalm-github-bot[bot] commented 4 years ago

Hey @iluuu1994, can you reproduce the issue on https://psalm.dev ?

iluuu1994 commented 4 years ago

can you reproduce the issue on https://psalm.dev?

Nope, the PASSWORD_ARGON2ID constant isn't recognized, but this would be the code: https://psalm.dev/r/8cf9e2fdbc

psalm-github-bot[bot] commented 4 years ago

I found these snippets:

https://psalm.dev/r/8cf9e2fdbc ```php
weirdan commented 4 years ago

Does the error go away if you run Psalm with --php-version=7.4 switch on?

iluuu1994 commented 4 years ago

Does the error go away if you run Psalm with --php-version=7.4 switch on?

Yes, that seems to fix it. Since PASSWORD_ARGON2ID will return a string or int depending on the PHP version that shouldn't matter though, right?

weirdan commented 4 years ago

What is likely happening here:

muglug commented 3 years ago

This appears fixed