Repository navigation
Stdlib: ReflectionProperty::getAsymmetricVisibility() — set/get masks (ext/reflection/php_reflection.c) #5060
Copy link
Copy link
Closed
Labels
IMPORTANTCritical pathCritical patharea:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsstdlib
Description
Activity
- addedenhancementNew feature or requestNew feature or requestphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsarea:vmVirtual machineVirtual machineimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claim
on Jun 3, 2026 Spec expansion (parity backlog run, Jun 2026)
This issue is blocked on language surface until asymmetric visibility compiles — see #6861 (
public private(set)parse fails today). Without #6861, repro sources using asymmetric properties never reach reflection.Dependency chain (claim order)
- Language: asymmetric visibility syntax (PHP 8.4 public private(set)) — parse fails Multiple access type modifiers #6861 — asymmetric visibility syntax + VM get/set enforcement
- Stdlib: ReflectionProperty::getAsymmetricVisibility() — set/get masks (ext/reflection/php_reflection.c) #5060 (this issue) —
ReflectionProperty::getAsymmetricVisibility() - Stdlib: ReflectionProperty::getAsymmetricVisibility() — static properties return wrong/null (ext/reflection/php_reflection.c) #6772 — static asymmetric properties return wrong/null (extends this API)
- Stdlib: get_class_vars() — static asymmetric properties missing from returned map (ext/standard/class.c) #6771 —
get_class_vars()must expose static asymmetric entries
Repro (still failing today)
<?php class C { public private(set) string $name = 'x'; } $r = new ReflectionProperty(C::class, 'name'); var_export($r->getAsymmetricVisibility()); echo "\n";
# PHP 8.4+ reference php repro.php # array('set' => ReflectionProperty::IS_PRIVATE, 'get' => ReflectionProperty::IS_PUBLIC) — bitmask ints ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh php bin/vm.php repro.php 2>&1 | head -3 ' # today: fails at compile (#6861) or undefined method
Symmetric control:
class S { public string $name = 'x'; } var_export((new ReflectionProperty(S::class, 'name'))->getAsymmetricVisibility()); // Zend: NULL
php-src reference
ext/reflection/php_reflection.c—reflection_property_get_asymmetric_visibilityZend/zend_compile.c— asymmetric ACC flags stored on property metadata
Done when (unchanged + explicit)
- Language: asymmetric visibility syntax (PHP 8.4 public private(set)) — parse fails Multiple access type modifiers #6861 green first (or same PR if worker owns chain)
-
getAsymmetricVisibility()returnsnullfor symmetric properties -
private(set)returns Zend-equivalentset/getinteger bitmasks (IS_PRIVATE,IS_PUBLIC, …) -
./script/ci-fast.sh --filter reflection_property_asymmetric_visibilitygreen
PHP-in-PHP: reflection metadata from compiler flags in
lib//VmReflection.php; no C reflection tables.claim: PHP Compiler STD Lib — starting this run
- added a commit that references this issue
on Jun 12, 2026 Merged via #8199.
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh php bin/vm.php test/repro-maintainer/reflection_get_asymmetric_visibility_5060.php vendor/bin/phpunit --filter reflection_property_asymmetric_visibility php bin/compile.php -l test/repro-maintainer/reflection_get_asymmetric_visibility_5060.php '
→ asymmetric instance/static return
['get'=>256,'set'=>1024]/['get'=>256,'set'=>512]; symmetricnull; PHPUnit OK; AOT lint exit 0.PHP path:
lib/VM/Builtin/ReflectionPropertyGetAsymmetricVisibility.php+VmReflection::propertyVisibilityMeta()/visibilityToReflectionBitmask(). No C runtime changes.
Metadata
Metadata
Assignees
Labels
IMPORTANTCritical pathCritical patharea:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsstdlib
Category
stdlib· php-src-strict · PHP 8.4 asymmetric visibility reflectionProblem
PHP 8.4 adds
ReflectionProperty::getAsymmetricVisibility(): ?arrayreturning visibility masks for get/set when they differ:(or
nullwhen symmetric). This compiler registersReflectionPropertybutgetAsymmetricVisibility()is undefined — callers fatal like any missing method.Instance asymmetric properties compile and run; static asymmetric reflection tracked in #6772. This issue covers instance
getAsymmetricVisibility()only.php-src reference
ext/reflection/php_reflection.c—reflection_property_get_asymmetric_visibility()Zend/zend_compile.c—ZEND_ACC_ASYMMETRIC_*on propertiesext/reflection/php_reflection.stub.phpRepro (failure today)
$name(public/private(set))IS_PUBLICget /IS_PRIVATEset$sym(symmetric public)nullExpected bitmask constants match
ReflectionProperty::IS_*(same integers as Zend).Scope (PHP-in-PHP first)
ext/standard/VmReflection.phpgetAsymmetricVisibility()reading compiler asymmetric flagslib/VM/BuiltinClasses.phpReflectionPropertylib/Compiler.php/*phpc-asymmetric-set:*/or ACC metadata available at link timetest/compliance/cases/stdlib/reflection_property_asymmetric_visibility.phptNo new C runtime.
Done when (php-src-strict)
method_exists($rp, 'getAsymmetricVisibility')true on VMnull./script/ci-fast.sh --filter reflection_property_asymmetricgreenRelated