Category
stdlib · php-src-strict
Problem
gc_status() must return the associative array defined by php-src. On Zend PHP 8.2+, the array contains runs, collected, threshold, and roots only.
This compiler returns additional keys (running, protected, full, buffer_size) from CycleCollector::status(), breaking code that iterates keys, compares to Zend snapshots, or uses array_key_exists('running', gc_status()).
php-src reference
Repro
test/repro-maintainer/gc_status_shape.php:
<?php
$s = gc_status();
ksort($s);
echo implode(',', array_keys($s)), "\n";
var_export(array_key_exists('running', $s));
echo "\n";
var_export(array_key_exists('runs', $s));
echo "\n";
Commands
php test/repro-maintainer/gc_status_shape.php
# Zend keys: collected,roots,runs,threshold
# running: false
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro-maintainer/gc_status_shape.php'
# VM today: includes running,protected,full,buffer_size; running: true
Scope (PHP-in-PHP)
| Path |
Work |
lib/VM/CycleCollector.php |
status() — emit only php-src keys (or gate extras behind internal debug) |
ext/standard/VmGcStatus.php |
statusTable() SSOT |
lib/JIT/Builtin/GcStatusRuntime.php |
JIT must call PHP helper (#9150) |
| Tests |
test/compliance/cases/stdlib/gc_status_shape.phpt |
PHP-in-PHP: shrink LLVM hashtable builder per #9150 once VM shape is correct.
Done when (php-src-strict)
Related
Category
stdlib· php-src-strictProblem
gc_status()must return the associative array defined by php-src. On Zend PHP 8.2+, the array containsruns,collected,threshold, androotsonly.This compiler returns additional keys (
running,protected,full,buffer_size) fromCycleCollector::status(), breaking code that iterates keys, compares to Zend snapshots, or usesarray_key_exists('running', gc_status()).php-src reference
ext/standard/php_gc.c—PHP_FUNCTION(gc_status)Zend/zend_gc.c—zend_gc_status()Repro
test/repro-maintainer/gc_status_shape.php:Commands
Scope (PHP-in-PHP)
lib/VM/CycleCollector.phpstatus()— emit only php-src keys (or gate extras behind internal debug)ext/standard/VmGcStatus.phpstatusTable()SSOTlib/JIT/Builtin/GcStatusRuntime.phptest/compliance/cases/stdlib/gc_status_shape.phptPHP-in-PHP: shrink LLVM hashtable builder per #9150 once VM shape is correct.
Done when (php-src-strict)
array_keys(gc_status())matches Zend set and order-insensitive equalityruns,collected,threshold,roots) semantics match aftergc_collect_cycles()smokeRelated
gc_mem_caches) · Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492