Skip to content

Stdlib: ReflectionAttribute::getTarget() missing — Zend returns Attribute::TARGET_* bitmask (ext/reflection/php_reflection.c) #22044

Description

@PurHur

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

  • ReflectionAttribute::getTarget() returns Zend’s Attribute::TARGET_* bitmask for class/method/param/property/const sites
  • Compliance .phpt under reflection/attributes
  • php-src-strict; no php-compiler-strict shortcut

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions