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

PHP8 shows Variable $data in empty() always exists and is not falsy. #7424

Closed
Khez opened this issue Jun 8, 2022 · 2 comments · Fixed by phpstan/phpstan-src#1431
Closed
Labels
Milestone

Comments

@Khez
Copy link

Khez commented Jun 8, 2022

Bug report

Using phpstan@1.7.11 (the bug exists as since 1.7.0 at least)

With the following composer.json

{
    "require": {
        "php": ">=8.0"
    }
}

The error shows up even if manually updating phpstan.neon.dist or phpstan.neon

parameters:
    phpVersion: 80000 # 8.0

The array_push function was updated in PHP 7.3:

This function can now be called with only one parameter. Formerly, at least two parameters have been required.

Code snippet that reproduces the problem

https://phpstan.org/r/68d9ad8d-cc02-4262-af12-bc5086ed4be4

Expected output

No error output.

@ondrejmirtes
Copy link
Member

/cc @herndlm I think you touched array_push last: phpstan/phpstan-src#1252

And looks like it's buggy - an array after array_push call can still be empty: https://3v4l.org/idilH

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

Successfully merging a pull request may close this issue.

2 participants