Skip to content

ReflectionClassConstant::getAttributes() is missing (Call to undefined method); symfony's ReflectionClassResource calls it. #244

Closed

Description

@blacktrs

Summary

ReflectionClassConstant::getAttributes() is missing (Call to undefined method); symfony's ReflectionClassResource calls it.

Repro

<?php

#[Attribute]
class Tag { public function __construct(public string $v = '') {} }

class K
{
    #[Tag('x')]
    const A = 1;
    const B = 2;
}

foreach ((new ReflectionClass('K'))->getReflectionConstants() as $c) {
    echo $c->name, ':';
    foreach ($c->getAttributes() as $a) { echo ' ', $a->getName(), json_encode($a->getArguments()); }
    echo "\n";
}

Expected (php)

A: Tag["x"]
B:

Actual (manticore eaed3dfe, Darwin arm64)

A:
[exit code 255]
PHP Fatal error:  Uncaught Error: Call to undefined method ReflectionClassConstant::getAttributes()

Tracking

Known-bug repro: tests/aot/repro/wrong/refl_class_constant_attributes.php — bash tests/aot/xfail.sh -k refl_class_constant_attributes reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 13, 2026
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

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions