Skip to content

Regression: gettype() on backed enum cases returns integer not object (re-#5496, basic_functions.c) #8810

Description

@PurHur

Category

stdlib — regression

Problem

gettype() on enum case objects must return "object" per Zend. Closed #5496 fixed VM/JIT for enum cases, but backed enum cases now report "integer" because case materialization returns backing scalars (#8746 regression class).

Distinct from #5797 (is_int() / is_object() predicates) and #5509 (get_debug_type()).

php-src reference

Repro

test/repro/maintainer_gettype_enum.php:

<?php
enum E: int { case A = 1; }
echo gettype(E::A), "\n";
php test/repro/maintainer_gettype_enum.php
# Zend: object

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gettype_enum.php'
# VM today: integer

Scope

Done when

  • Repro prints object under VM (+ JIT/AOT if lowered)
  • ./script/ci-fast.sh --filter gettype_enum or compliance PHPT green
  • php-src-strict

Links

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