Skip to content

Regression: AOT UnhandledMatchError/DivisionByZeroError get_class empty — instanceof works (re-#27625, zend_exceptions.c) #29747

Closed

Description

@PurHur

Category

Regression · php-src-strict · AOT exception object identity (re-#27625)

Problem

Under AOT, several engine errors are catchable and pass instanceof, but get_class($e) returns "" and (for match) getMessage() is also empty. Zend/VM report the real class + message.

Probed 2026-08-10 — AOT vs PROFILE=8.4 VM / php:8.4-cli.

Repro Zend 8.4 / VM AOT
match (3) { 1 => 'a' } UnhandledMatchError / Unhandled match case 3 instanceof UnhandledMatchError true; get_class ""; message ""
$a=1; $b=0; $a % $b DivisionByZeroError / Modulo by zero instanceof true; get_class ""; message OK
intdiv(1,0) DivisionByZeroError class name OK (control)

Prior closed: #27625 (never-typed throw empty get_class) — same symptom class, new call sites.

php-src reference

PHP implementation target

  • AOT exception allocation / class-name string for UnhandledMatchError, DivisionByZeroError (modulo path), and any sibling empty-get_class sites
  • Ensure get_class, ->getMessage(), and instanceof all agree with Zend; PHP-in-PHP

Repro

./script/docker-exec.sh -- bash -lc 'cat > /tmp/aot_ume.php <<'"'"'PHP'"'"'
<?php
try {
  match (3) { 1 => "a" };
} catch (Throwable $e) {
  echo "class=[", get_class($e), "] msg=[", $e->getMessage(), "]\n";
  echo "ume="; var_export($e instanceof UnhandledMatchError); echo "\n";
}
PHP
PHP_COMPILER_PROFILE=8.4 php bin/compile.php -o /tmp/aot_ume /tmp/aot_ume.php && /tmp/aot_ume'
# expect: class=[UnhandledMatchError] msg=[Unhandled match case 3]
# actual: class=[] msg=[] with instanceof true

Done when

  • AOT get_class($e) / message match Zend for unhandled match and modulo-by-zero
  • instanceof remains true
  • Compliance .phpt guard
  • php-src-strict

Activity

  1. added
    bugSomething isn't working
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Aug 10, 2026
  2. PurHur commented on Aug 10, 2026

    @PurHur
    OwnerAuthor

    claim: Worker lane C (implementer) — starting this run

    Gates before claim (partial):

  3. PurHur commented on Aug 10, 2026

    @PurHur
    OwnerAuthor

    Merged via #29790

    Verification (issue repro):

    class=[UnhandledMatchError] msg=[Unhandled match case 3]
    ume=true
    class=[DivisionByZeroError] msg=[Modulo by zero]
    

    Also: GetClassRuntimeShrinkTest OK; AOT fixture unhandled_match_get_class_29747 OK.

    Gates before claim: inventory drift noted; release-readiness had spine-coverage + north-star5-fast red on master (Pillar 1; out of scope for this AOT language fix).

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 / JITbugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions