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

New elements in array returned by gc_status() #10022

Closed
sebastianbergmann opened this issue Jul 16, 2023 · 4 comments · Fixed by #10138
Closed

New elements in array returned by gc_status() #10022

sebastianbergmann opened this issue Jul 16, 2023 · 4 comments · Fixed by #10138

Comments

@sebastianbergmann
Copy link
Contributor

In PHP 8.3, the array returned by the gc_status() function has 8 additional elements: running (bool), protected (bool), full (bool), buffer_size (int), application_time (float), collector_time (float), destructor_time (float), and free_time (float).

Running Psalm on PHP 8.3 specific code in PHPUnit, I currently get:

ERROR: InvalidArrayOffset - src/Event/Facade.php:252:20 - Cannot access value on variable  using offset value of 'running', expecting 'runs', 'collected', 'threshold' or 'roots' (see https://psalm.dev/115)
        if (!isset(gc_status()['running'])) {


ERROR: InvalidArrayOffset - src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php:28:13 - Cannot access value on variable $status using offset value of 'application_time', expecting 'runs', 'collected', 'threshold' or 'roots' (see https://psalm.dev/115)
            $status['application_time'],


ERROR: InvalidArrayOffset - src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php:29:13 - Cannot access value on variable $status using offset value of 'collector_time', expecting 'runs', 'collected', 'threshold' or 'roots' (see https://psalm.dev/115)
            $status['collector_time'],


ERROR: InvalidArrayOffset - src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php:30:13 - Cannot access value on variable $status using offset value of 'destructor_time', expecting 'runs', 'collected', 'threshold' or 'roots' (see https://psalm.dev/115)
            $status['destructor_time'],


ERROR: InvalidArrayOffset - src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php:31:13 - Cannot access value on variable $status using offset value of 'free_time', expecting 'runs', 'collected', 'threshold' or 'roots' (see https://psalm.dev/115)
            $status['free_time'],


ERROR: InvalidArrayOffset - src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php:32:13 - Cannot access value on variable $status using offset value of 'running', expecting 'runs', 'collected', 'threshold' or 'roots' (see https://psalm.dev/115)
            $status['running'],


ERROR: InvalidArrayOffset - src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php:33:13 - Cannot access value on variable $status using offset value of 'protected', expecting 'runs', 'collected', 'threshold' or 'roots' (see https://psalm.dev/115)
            $status['protected'],


ERROR: InvalidArrayOffset - src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php:34:13 - Cannot access value on variable $status using offset value of 'full', expecting 'runs', 'collected', 'threshold' or 'roots' (see https://psalm.dev/115)
            $status['full'],


ERROR: InvalidArrayOffset - src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php:35:13 - Cannot access value on variable $status using offset value of 'buffer_size', expecting 'runs', 'collected', 'threshold' or 'roots' (see https://psalm.dev/115)
            $status['buffer_size'],
@psalm-github-bot
Copy link

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

@orklah
Copy link
Collaborator

orklah commented Jul 16, 2023

Are you sure Psalm is running in 8.3 in analysis? gc_status was changed already here: https://github.com/vimeo/psalm/pull/9366/files

@sebastianbergmann
Copy link
Contributor Author

That commit seems to only add 4 of the 8 fields. The other 4 were added today: php/php-src#11523

weirdan added a commit to weirdan/psalm that referenced this issue Aug 21, 2023
@sebastianbergmann
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants