Skip to content

Stdlib: get_class() on enum case must return enum name not false (ext/standard/basic_functions.c) #5484

Description

@PurHur

Category

stdlib · php-src-strict

Problem

get_class() on an enum case must return the enum class name (e.g. "E"). Issue filed when VM returned false.

Maintainer re-probe (2026-06-06): VM now returns string(1) "E" — matches Zend on php bin/vm.php -r 'enum E { case A; } var_dump(get_class(E::A));'. Remaining work is to lock parity in compliance tests and verify JIT/AOT paths (if they bypass get_class() VM handler).

php-src reference

Related: #4260 (get_debug_type() on enum cases) — separate builtin, same enum-case object path.

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "enum E { case A; } var_dump(get_class(E::A));"
php -r "enum E { case A; } var_dump(get_class(E::A));"
php bin/jit.php -r "enum E { case A; } var_dump(get_class(E::A));" 2>&1
'
Check Zend VM (2026-06-06) JIT
get_class(E::A) "E" "E" verify
get_class($object) plain object class name unchanged verify
get_class() no args in method scope $this class unchanged verify

Add test/repro/parity_get_class_enum.php (or move from test/repro-maintainer/ if present).

Scope (this repo)

Path Work
ext/standard/get_class_.php Confirm enum-case branch
ext/standard/VmReflection.php Enum case class-id resolution
lib/JIT/Builtin/ JIT lowering if missing
test/compliance/cases/stdlib/get_class_enum.phpt VM + JIT + AOT

Done when

  • Compliance .phpt green on VM, JIT, AOT
  • get_class() with no args / two args edge cases on enum cases unchanged vs Zend
  • Close this issue once tests land (VM fix appears present)

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 machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions