Category
language · php-src-strict · PHP 8.4 asymmetric visibility
Problem
Combining explicit public with private(set) on the same property is a parse/compile error in Zend ("Multiple access type modifiers are not allowed"). This compiler accepts the declaration and runs user code.
| Repro |
Zend 8.2+ |
VM (2026-07-04) |
public private(set) string \$x; |
parse error (multiple access modifiers) |
compiles; echoes hi then Error on external write |
php-src reference
PHP implementation target
lib/Compiler.php / parser — reject public + private(set) / protected(set) combinations at parse or compile time
lib/ property visibility lowering — do not treat as valid asymmetric visibility until grammar matches php-src
Repro
./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_asymmetric_visibility_public_private_set.php
Done when
Category
language· php-src-strict · PHP 8.4 asymmetric visibilityProblem
Combining explicit
publicwithprivate(set)on the same property is a parse/compile error in Zend ("Multiple access type modifiers are not allowed"). This compiler accepts the declaration and runs user code.public private(set) string \$x;hithenErroron external writephp-src reference
Zend/zend_compile.c— property modifier validation (zend_compile_property_decl)Zend/zend_language_parser.y— asymmetric visibility grammarPHP implementation target
lib/Compiler.php/ parser — rejectpublic+private(set)/protected(set)combinations at parse or compile timelib/property visibility lowering — do not treat as valid asymmetric visibility until grammar matches php-srcRepro
Done when
Erroron valid-looking code).phptguard undertest/compliance/cases/language/