Category
language
Problem
PHP 8.4 asymmetric property visibility includes a read side (public private(get), protected private(get), etc.), not only private(set) / protected(set) / public(set) on writes.
This repo’s lib/Ast/AsymmetricVisibilityRewriter.php rewrites set modifiers only (MARKER_PREFIX = phpc-asymmetric-set:). There is no marker or VM/JIT guard for get visibility, and no compliance coverage for private(get) / protected(get).
Zend rejects illegal read/write combinations at compile time and enforces read access in zend_object_handlers.c.
php-src reference
Repro (expected Zend vs today)
<?php
class Box {
public private(get) string $secret = 'hidden';
}
$b = new Box();
echo $b->secret, "\n"; // global scope: Error — cannot access private(get) property
php repro.php
# Zend: Error: Cannot access private(get) property Box::$secret from global scope
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
# Today: likely parse/compile failure or treats as ordinary public read (parity drift)
Also verify combined forms compile when valid in Zend, e.g. public protected(set) string $x.
Scope (this repo)
| Area |
Path |
| Parse/rewrite |
lib/Ast/AsymmetricVisibilityRewriter.php, lib/Runtime.php preprocessor |
| PHPCfg flags |
lib/Compiler.php — propertySetVisibility + new get visibility storage |
| VM read guard |
lib/VM.php — mirror asymmetricPropertyWriteMessage() for reads |
| JIT/AOT |
lib/JIT/AsymmetricVisibilityGuard.php — read-side LLVM guard (phase 2 OK) |
| Tests |
test/compliance/cases/language/asymmetric_visibility_private_get.phpt |
Done when
Related
Category
languageProblem
PHP 8.4 asymmetric property visibility includes a read side (
public private(get),protected private(get), etc.), not onlyprivate(set)/protected(set)/public(set)on writes.This repo’s
lib/Ast/AsymmetricVisibilityRewriter.phprewrites set modifiers only (MARKER_PREFIX = phpc-asymmetric-set:). There is no marker or VM/JIT guard for get visibility, and no compliance coverage forprivate(get)/protected(get).Zend rejects illegal read/write combinations at compile time and enforces read access in
zend_object_handlers.c.php-src reference
Zend/zend_compile.c—ZEND_ACC_PUBLIC_GET,ZEND_ACC_PROTECTED_GET,ZEND_ACC_PRIVATE_GET(and set counterparts)Zend/zend_object_handlers.c—zend_std_read_propertyasymmetric checksRepro (expected Zend vs today)
Also verify combined forms compile when valid in Zend, e.g.
public protected(set) string $x.Scope (this repo)
lib/Ast/AsymmetricVisibilityRewriter.php,lib/Runtime.phppreprocessorlib/Compiler.php—propertySetVisibility+ new get visibility storagelib/VM.php— mirrorasymmetricPropertyWriteMessage()for readslib/JIT/AsymmetricVisibilityGuard.php— read-side LLVM guard (phase 2 OK)test/compliance/cases/language/asymmetric_visibility_private_get.phptDone when
private(get)/protected(get)properties parse and compile on VMErrormatching Zend textprivate(set)tests still pass (asymmetric_visibility_*.phpt)./script/ci-fast.sh --filter asymmetric_visibility_private_getgreenRelated
private(set)write guards · Language: asymmetric visibility on constructor-promoted properties (zend_compile.c parity) #4690 promoted properties · Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492 self-host