Skip to content

class_exists() of a built-in class the program never names statically answers false #409

Closed

Description

@blacktrs

Summary

class_exists() of a built-in class the program never names statically answers false.

Repro

<?php
$n = 'Date' . 'Time';
var_dump(class_exists($n));

Expected (php)

bool(true)

Actual (manticore 57b5de57, Darwin arm64)

bool(false)

Tracking

Known-bug repro: tests/aot/repro/wrong/class_exists_false_for_unnamed_builtin_class.php — bash tests/aot/xfail.sh -k class_exists_false_for_unnamed_builtin_class 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 23, 2026
  2. blacktrs commented on Oct 24, 2026

    @blacktrs
    ContributorAuthor

    Decision: no change for now. Built-in classes (DateTime and friends) are prelude files pulled in only when the program names them, so class_exists() of a name built at run time answers false. Pulling in every built-in class on a dynamic class_exists/new costs binary size and compile time. Kept open for later; candidate approach: include them all only when the program contains a dynamic class name.

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