Repository navigation
Stdlib: ReflectionProperty::getSettableType()/getReadableType() — PHP 8.4 asymmetric visibility probes missing (ext/reflection/php_reflection.c) #7053
Copy link
Copy link
Closed
Labels
area: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-2:languagePhase 2 – language featuresPhase 2 – language featuresphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web apps
Description
Category
stdlib · php-src-strict
Problem
PHP 8.4 adds reflection helpers for asymmetric property visibility (public private(set) int $x):
ReflectionProperty::getSettableType(): ?ReflectionTypeReflectionProperty::getReadableType(): ?ReflectionType
This compiler registers ReflectionProperty but does not expose these methods (method_exists → false). Workers already track asymmetric compile rules (#7013 closed), getAsymmetricVisibility() (#5060, #6977), and hook/raw APIs — the readable/settable type split is still missing.
php-src reference
- php/php-src
ext/reflection/php_reflection.c—reflection_property_get_settable_type,reflection_property_get_readable_type - php/php-src
Zend/zend_compile.c— asymmetric visibility flags onzend_property_info
Repro
<?php
class C {
public private(set) int $x = 1;
}
$p = new ReflectionProperty(C::class, 'x');
var_dump(method_exists($p, 'getSettableType'));
var_dump(method_exists($p, 'getReadableType'));
if (method_exists($p, 'getSettableType')) {
var_dump((string) $p->getReadableType(), (string) $p->getSettableType());
}./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "...repro..." # both method_exists → false
php -r "...repro..." # PHP 8.4+: both true, readable int / settable null or private
'| Check | Zend 8.4+ | VM today |
|---|---|---|
getReadableType() registered |
yes | missing ❌ |
getSettableType() registered |
yes | missing ❌ |
| Unit enum / hook property edge cases | per php-src | add compliance |
Scope
| Path | Work |
|---|---|
ext/reflection/ or lib/VM/Builtin/ReflectionProperty*.php |
register methods on VM ReflectionProperty |
lib/JIT/Call/ReflectionProperty*.php |
optional JIT stubs if reflection invoked in hot paths |
| Tests | test/compliance/cases/stdlib/reflection_property_readable_settable_type.phpt |
Implement in PHP (ext/ + VM handlers); no new C in runtime/.
Done when
- Repro
method_existstrue for both methods on PHP 8.4+ asymmetric property - Return types match Zend for public/private(set), protected/public(set), and plain typed props
-
./script/ci-fast.sh --filter reflection_property_readable_settable_typegreen
Related
- Stdlib: ReflectionProperty::getAsymmetricVisibility() — set/get masks (ext/reflection/php_reflection.c) #5060 / Stdlib: ReflectionProperty isPrivateSet()/isProtectedSet()/isPublicSet() — asymmetric visibility probes missing (PHP 8.4, ext/reflection/php_reflection.c) #6977 (asymmetric visibility probes) · Language: static asymmetric visibility — public private(set) static must compile fatal (PHP 8.4, zend_compile.c) #7013 (static asymmetric compile) · Stdlib: ReflectionProperty::setRawValue()/getRawValue() — bypass hooks for init (PHP 8.4, ext/reflection/php_reflection.c) #6451 (setRawValue) · Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: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-2:languagePhase 2 – language featuresPhase 2 – language featuresphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web apps
Activity
PurHur commentedon Jun 12, 2026
claim: worker-lane-a — starting this run
Implement ReflectionProperty::getReadableType()/getSettableType() (#7053
PurHur commentedon Jun 12, 2026
Merged via #8120.
Verification:
Output:
method_existstrue for both probes;(string) getReadableType()/getSettableType()→intforpublic private(set) int $x; compliance phpt OK (2 tests).