Skip to content

Language: gettype() JIT — enum case and boxed enum must return object (ext/standard/basic_functions.c) #5496

Description

@PurHur

Category

language | stdlib

Problem

VM gettype() already maps Variable::TYPE_ENUM_CASE to 'object' (ext/standard/gettype.php). JIT path uses JitGettype::boxed() / TYPE_OBJECT only — enum cases passed as boxed __value__ can hit LogicException: gettype() does not support this value type on MCJIT execute.

Blocked for end-to-end repro until #5491 (backed enum compile) is fixed; then JIT tier must match Zend.

php-src reference

Repro (after #5491)

<?php
enum E: string { case A = 'x'; }
echo gettype(E::A), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro.php
php bin/vm.php repro.php
php bin/jit.php repro.php
'
Runtime Output
Zend object
VM (expected) object
JIT today fatal LogicException or wrong type label

Scope (this repo)

Layer Path
VM ext/standard/gettype.php — verify enum case path
JIT ext/standard/JitGettype.php, gettype.php::call() — handle TYPE_ENUM_CASE / boxed enum tag
Tests test/compliance/cases/stdlib/gettype_enum_case.phpt

Done when

  • Repro prints object on VM and JIT/AOT
  • ./script/ci-fast.sh --filter gettype_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:compilerCompiler / CFG / JITarea:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language featuresphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions