Skip to content

new, instanceof and static calls through a name created by class_alias() at run time do not resolve: Class "B" not found. #653

Open

Description

@blacktrs

Summary

new, instanceof and static calls through a name created by class_alias() at run time do not resolve: Class "B" not found.

Repro

<?php
class A { public static function who(): string { return static::class; } }
class_alias("A", "B");
$b = new B();
var_dump($b instanceof A, $b instanceof B, B::who(), get_class($b));

Expected (php)

bool(true)
bool(true)
string(1) "A"
string(1) "A"

Actual (manticore da108790, Darwin arm64)

compile failed (rc=65):
tests/aot/repro/wrong/class_alias_runtime_new.php:6: error[undefined.class]: class B is not declared (reachable: __main)
front end: 1 error(s), 0 warning(s)
compile: front-end (parse/typeck/IR) returned null (rc=65)

Tracking

Known-bug repro: tests/aot/repro/wrong/class_alias_runtime_new.php — bash tests/aot/xfail.sh -k class_alias_runtime_new 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 Nov 12, 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