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

Incorrect signature for the set_error_handler() callback in PHP >= 8 #6619

Closed
johnbillion opened this issue Feb 9, 2022 · 5 comments · Fixed by phpstan/phpstan-src#1008
Closed

Comments

@johnbillion
Copy link
Contributor

johnbillion commented Feb 9, 2022

Bug report

Since PHP 8 the $errcontext parameter is no longer passed to the callback registered with set_error_handler(). This is not detected by PHPStan.

Code snippet that reproduces the problem

Expected output

The $errcontext parameter of the callback signature should be conditional depending on the PHP version.

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

Always :-)

@ondrejmirtes
Copy link
Member

This is the actually crashing code that should be reported by PHPStan on PHP 8.0+: https://3v4l.org/pp25P

Looks like set_error_handler doesn't have an item in https://github.com/phpstan/phpstan-src/blob/master/resources/functionMap.php. Please add it to this file with a signature relevant for 7.4.

And then add a line in https://github.com/phpstan/phpstan-src/blob/master/resources/functionMap_php80delta.php with a signature relevant for 8.0+.

Thanks.

@johnbillion
Copy link
Contributor Author

There is an entry, I think there's something up with GitHub's rendering of large files. I'm working on a PR at the moment.

@ondrejmirtes
Copy link
Member

Awesome 👍

@ondrejmirtes
Copy link
Member

@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 Mar 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants