Category
Stdlib · php-src-strict · Reflection attributes
Problem
ReflectionAttribute::getTarget() is missing on the VM while getName(), getArguments(), isRepeated(), and newInstance() work. Zend returns the Attribute::TARGET_* bitmask for the reflected declaration site (class → Attribute::TARGET_CLASS = 1) (2026-07-22).
| Repro |
Zend 8.2+ |
VM (2026-07-22) |
#[RA] class T{} → getAttributes()[0]->getTarget() |
1 (TARGET_CLASS) |
method missing / fatal |
same → isRepeated() with IS_REPEATABLE |
true |
true (OK) |
php-src reference
PHP implementation target
ext/standard/VmReflection.php (or reflection attribute helper) — expose getTarget(): int from stored attribute metadata
- Preserve target bits at attribute compile/bind time; no new C runtime
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_reflection_attribute_get_target.php'
# compare: php test/repro/maintainer_gap_reflection_attribute_get_target.php
Done when
Category
Stdlib· php-src-strict · Reflection attributesProblem
ReflectionAttribute::getTarget()is missing on the VM whilegetName(),getArguments(),isRepeated(), andnewInstance()work. Zend returns theAttribute::TARGET_*bitmask for the reflected declaration site (class →Attribute::TARGET_CLASS= 1) (2026-07-22).#[RA] class T{}→getAttributes()[0]->getTarget()1(TARGET_CLASS)isRepeated()withIS_REPEATABLEtruetrue(OK)php-src reference
ext/reflection/php_reflection.c—zim_reflection_attribute_getTargetZend/zend_attributes.h—ZEND_ATTRIBUTE_TARGET_*isRepeated), Language: ReflectionAttribute::newInstance() — instantiate attribute objects (ext/reflection parity) #3206 (newInstance) — this is the remaininggetTargetleafPHP implementation target
ext/standard/VmReflection.php(or reflection attribute helper) — exposegetTarget(): intfrom stored attribute metadataRepro
Done when
ReflectionAttribute::getTarget()returns Zend’sAttribute::TARGET_*bitmask for class/method/param/property/const sites.phptunder reflection/attributes