Skip to content

constant() of a constant on an undeclared class says "Undefined constant X::C" where php says Class "X" not found #604

Closed

Description

@blacktrs

Summary

constant() of a constant on an undeclared class says "Undefined constant X::C" where php says Class "X" not found.

Repro

<?php
try { constant("Nope\\Missing::C"); } catch (Error $e) { echo get_class($e), ": ", $e->getMessage(), "\n"; }

Expected (php)

Error: Class "Nope\Missing" not found

Actual (manticore 071aa567, Darwin arm64)

Error: Undefined constant Nope\Missing::C

Tracking

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