You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Language: readonly class typed property defaults rejected at compile — valid since PHP 8.2 (Zend/zend_compile.c) #9841
Since PHP 8.2, readonly classes may declare typed properties with default values (initialized at object creation). This compiler rejects the pattern at compile time:
Readonly property R::$n cannot have default value
Constructor-only initialization works; the compile-time default form does not.
Blocker: current behavior matches php-src-strict. PHP 8.2.31 (Docker) and php-src master zend_compile.c (~L9241) both emit Readonly property R::$n cannot have default value for readonly class R { public int $n = 1; }. Releasing claim — issue acceptance criteria contradict Zend reference.
Repro still fails on master; committed path test/repro/maintainer_gap_readonly_class_typed_default.php is missing from tree — use inline repro below.
Verified failure
./script/docker-exec.sh -- bash -lc 'source script/php-env.shphp bin/vm.php -r "readonly class R { public int \$x = 1; } echo (new R())->x, \"\\n\";" 2>&1php -r "readonly class R { public int \$x = 1; } echo (new R())->x, \"\\n\";" 2>&1'
Engine
Result
Zend PHP 8.2
1
VM today
parseAndCompile failure: Readonly property R::$x cannot have default value
Constructor-only init (readonly class R { public int $x; function __construct(){ $this->x=1; } }) may still work — this issue is typed default at declaration only.
claim released: php-src-strict — Docker PHP 8.2.31 rejects readonly class R { public int $x = 1; } with Readonly property R::$x cannot have default value (same as VM). Issue acceptance contradicts Zend; no code change.
Docker PHP 8.2.31 and VM both reject readonly class R { public int $x = 1; } with Readonly property R::$x cannot have default value. RFC/manual: explicit defaults on readonly properties/classes are forbidden; constructor-promoted defaults are the supported form (already green: ReadonlyClassCompileCheckTest::testReadonlyClassConstructorPromotedPropertyStillCompiles).
The maintainer spec refresh (2026-06-19 15:48) table claiming Zend prints 1 does not match this environment. Recommend close as invalid — implementing done-when would regress #9653 compliance.
Constructor-promoted defaults on readonly classes already work (testReadonlyClassConstructorPromotedPropertyStillCompiles)
The maintainer spec refresh table claiming Zend prints 1 does not match Docker Zend or php-src master. Recommend close as invalid — implementing done-when would regress #9653 compliance.
Closing as invalid: Zend/php-src and this compiler correctly reject typed property defaults on readonly classes. Only constructor-promoted defaults are allowed (PHP 8.2+). Verified 2026-06-22 on Docker PHP 8.2.31 + VM.
Activity
PurHur commentedon Jun 19, 2026
claim: cursor-agent-lane-b — starting this run
PurHur commentedon Jun 19, 2026
Blocker: current behavior matches php-src-strict. PHP 8.2.31 (Docker) and php-src master
zend_compile.c(~L9241) both emitReadonly property R::$n cannot have default valueforreadonly class R { public int $n = 1; }. Releasing claim — issue acceptance criteria contradict Zend reference.PurHur commentedon Jun 19, 2026
claim: cursor-agent-lane-b — verification run (no code change)
php-src-strict verdict: issue acceptance contradicts Zend
Evidence:
readonly class R { public int $n = 1; }→ Fatal error: Readonly property R::$n cannot have default valueReadonlyClassCompileCheckTest::testReadonlyClassPropertyDefaultFailsAtCompileTime(Language: readonly class properties must reject default values at compile time (Zend/zend_compile.c) #9653) expects this compile errortestReadonlyClassConstructorPromotedPropertyStillCompiles)Implementing issue acceptance would regress php-src parity. Recommend close as invalid.
Releasing claim — no PR.
PurHur commentedon Jun 19, 2026
Spec]))
Spec refresh — verified 2026-06-19 (docker-exec)
Repro still fails on master; committed path
test/repro/maintainer_gap_readonly_class_typed_default.phpis missing from tree — use inline repro below.Verified failure
1parseAndCompile failure: Readonly property R::$x cannot have default valueConstructor-only init (
readonly class R { public int $x; function __construct(){ $this->x=1; } }) may still work — this issue is typed default at declaration only.Done-when (unchanged + guard)
1test/repro/maintainer_gap_readonly_class_typed_default.php+test/compliance/cases/language/readonly_class_typed_default.phpt./script/ci-fast.sh --filter readonly_class_typed_defaultgreenPurHur commentedon Jun 19, 2026
(typo in prior comment: ignore stray
## Spec]))line — content below is authoritative.)PurHur commentedon Jun 19, 2026
claim: cursor-agent-lane-b — starting this run
PurHur commentedon Jun 19, 2026
claim released: php-src-strict — Docker PHP 8.2.31 rejects
readonly class R { public int $x = 1; }withReadonly property R::$x cannot have default value(same as VM). Issue acceptance contradicts Zend; no code change.PurHur commentedon Jun 20, 2026
claim: cursor-agent-lane-b — verification run (no code change)
php-src-strict: issue acceptance contradicts Zend (re-confirmed 2026-06-20)
Docker PHP 8.2.31 and VM both reject
readonly class R { public int $x = 1; }withReadonly property R::$x cannot have default value. RFC/manual: explicit defaults on readonly properties/classes are forbidden; constructor-promoted defaults are the supported form (already green:ReadonlyClassCompileCheckTest::testReadonlyClassConstructorPromotedPropertyStillCompiles).The maintainer spec refresh (2026-06-19 15:48) table claiming Zend prints
1does not match this environment. Recommend close as invalid — implementing done-when would regress #9653 compliance.Releasing claim — no PR.
PurHur commentedon Jun 20, 2026
claim: cursor-agent-lane-b — verification run (no code change)
php-src-strict: issue acceptance contradicts Zend (re-confirmed 2026-06-20)
Evidence:
readonly class R { public int $x = 1; }withReadonly property R::$x cannot have default valueZend/zend_compile.cline ~9243 emits the same compile errorReadonlyClassCompileCheckTest::testReadonlyClassPropertyDefaultFailsAtCompileTime(Language: readonly class properties must reject default values at compile time (Zend/zend_compile.c) #9653) expects this compile errortestReadonlyClassConstructorPromotedPropertyStillCompiles)The maintainer spec refresh table claiming Zend prints
1does not match Docker Zend or php-src master. Recommend close as invalid — implementing done-when would regress #9653 compliance.Releasing claim — no PR.
PurHur commentedon Jun 20, 2026
claim: cursor-agent-lane-b — verification run (no code change)
php-src-strict: issue acceptance contradicts Zend (re-confirmed 2026-06-20)
Evidence:
readonly class R { public int $x = 1; }→ Fatal error: Readonly property R::$x cannot have default valueparseAndCompile failure: Readonly property R::$x cannot have default valueReadonlyClassCompileCheckTest::testReadonlyClassPropertyDefaultFailsAtCompileTime(Language: readonly class properties must reject default values at compile time (Zend/zend_compile.c) #9653) expects compile errortestReadonlyClassConstructorPromotedPropertyStillCompiles)Maintainer spec refresh table (Zend prints
1) does not match Docker Zend 8.2.31 or VM.Recommend close as invalid — implementing done-when would regress #9653 compliance.
Releasing claim — no PR.
PurHur commentedon Jun 22, 2026
claim: cursor-agent-lane-b — verification run (no code change)
php-src-strict: issue acceptance contradicts Zend (re-confirmed 2026-06-22)
Evidence:
readonly class R { public int $n = 1; }→ Fatal error: Readonly property R::$n cannot have default valueparseAndCompile failure: Readonly property R::$n cannot have default valueReadonlyClassCompileCheckTest::testReadonlyClassPropertyDefaultFailsAtCompileTime(Language: readonly class properties must reject default values at compile time (Zend/zend_compile.c) #9653) expects compile errortestReadonlyClassConstructorPromotedPropertyStillCompiles)Implementing done-when would regress #9653 compliance. Recommend close as invalid.
PurHur commentedon Jun 22, 2026
Closing as invalid: Zend/php-src and this compiler correctly reject typed property defaults on readonly classes. Only constructor-promoted defaults are allowed (PHP 8.2+). Verified 2026-06-22 on Docker PHP 8.2.31 + VM.