Category
language · php-src-strict · profile gate
Problem
Typed static locals (static int $x = 0;) are a PHP 8.3+ feature. On the project's default 8.2 language profile, Zend rejects the syntax at parse time; this compiler accepts and executes the function body.
| Repro |
Zend 8.2 |
VM (2026-07-05) |
function f(){ static int $x=0; return ++$x; } f(); |
parse error |
1 |
php-src reference
PHP implementation target
lib/Parser.php / compile path for static variables — reject typed static locals when PHP_COMPILER_LANGUAGE_PROFILE (or equivalent) is < 8.3
- Future 8.3+ profile may enable; gate behind profile version, not unconditional acceptance
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php test/repro/maintainer_gap_typed_static_local_variable.php'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_typed_static_local_variable.php'
Done when
Category
language· php-src-strict · profile gateProblem
Typed static locals (
static int $x = 0;) are a PHP 8.3+ feature. On the project's default 8.2 language profile, Zend rejects the syntax at parse time; this compiler accepts and executes the function body.function f(){ static int $x=0; return ++$x; } f();1php-src reference
Zend/zend_compile.c—zend_compile_var()typed static locals (PHP 8.3)PHP implementation target
lib/Parser.php/ compile path forstaticvariables — reject typed static locals whenPHP_COMPILER_LANGUAGE_PROFILE(or equivalent) is< 8.3Repro
Done when
.phptguard undertest/compliance/cases/language/