Skip to content

Stdlib: get_debug_type() — enum cases must return enum class name (ext/standard/type.c parity) #4260

Description

@PurHur

Category

stdlib

Problem

get_debug_type() handles scalars and objects but not enum case values (Variable::TYPE_ENUM_CASE). Passing a backed or unit enum case throws LogicException: get_debug_type() does not support this value type in this compiler build.

Zend returns the enum class name (same string as get_class($case) on enum cases in PHP 8.1+).

php-src reference

Repro (failure today)

<?php
declare(strict_types=1);
// test/repro-maintainer/get_debug_type_enum.php

enum Color: string { case Red = 'r'; }
enum Size { case S; }

echo get_debug_type(Color::Red), "\n";
echo get_debug_type(Size::S), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro-maintainer/get_debug_type_enum.php
php bin/vm.php test/repro-maintainer/get_debug_type_enum.php
'
Call Zend PHP 8.x This compiler VM (today)
get_debug_type(Color::Red) Color LogicException
get_debug_type(Size::S) Size LogicException

Scope (this repo)

Module Path
VM ext/standard/get_debug_type.php — branch on Variable::TYPE_ENUM_CASE
JIT get_debug_type.php call() + boxed TYPE_VALUE path
Tests test/compliance/cases/stdlib/get_debug_type_enum.phpt

Out of scope here: resource type label (separate issue if streams expose resources without get_resource_type parity).

Done when

  • Repro prints Color and Size on VM matching Zend
  • JIT/AOT compliance for enum case argument passes
  • ./script/ci-fast.sh --filter get_debug_type_enum green

Related

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