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

Regression - incorrect parameter name for base64_decode() #9428

Closed
dktapps opened this issue Jun 11, 2023 · 3 comments
Closed

Regression - incorrect parameter name for base64_decode() #9428

dktapps opened this issue Jun 11, 2023 · 3 comments
Labels

Comments

@dktapps
Copy link
Contributor

dktapps commented Jun 11, 2023

Bug description

Error messages involving wrong types for base64_decode() started reporting different parameter names sometime between 1.10.16 and 1.10.18.

We can see from php --rf base64_decode that the parameter name should be $string:

$ php --rf base64_decode
Function [ <internal:standard> function base64_decode ] {

  - Parameters [2] {
    Parameter #0 [ <required> string $string ]
    Parameter #1 [ <optional> bool $strict = false ]
  }
  - Return [ string|false ]
}

But the error message claims the parameter is called $str.

Code snippet that reproduces the problem

https://phpstan.org/r/7dba8189-f75d-46cd-a6ac-9a6d685e5f9c

Expected output

Parameter #1 $string of function base64_decode expects string, int given.

Did PHPStan help you today? Did it make you happy in any way?

No response

@ondrejmirtes
Copy link
Member

This parameter name change is kind of an accident that happened because of this commit: phpstan/phpstan-src@cee6672

Yeah, it's not obvious from that, but the fact that it has two variants since then means that a different path is taken in Php8SignatureMapProvider and the name is taken from somewhere else.

Normally it'd be just a cosmetic change, but this change broke named arguments too: https://phpstan.org/r/7fa6b4f5-90c6-4c80-b208-2449a43e52e7

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src#2529

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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

No branches or pull requests

2 participants