Skip to content

Regression: throw expressions — compile aborts (PHPTypes TypeReconstructor missing Expr_Throw, reopen #3802) #6746

Description

@PurHur

Category

language · php-src-strict · IMPORTANT

Problem

PHP 8.0 throw expressions (throw in ternary/??/assignment) should compile and run on the VM path (#3802, closed). On current master, every throw-expression script fails at parseAndCompile before bytecode emission:

parseAndCompile failure: … Unknown variable op found: Expr_Throw

Root cause: ircmaxell/php-types TypeReconstructor::resolveOp() has no Expr_Throw case and throws at the tail default (prelinked/bootstrap-vendor/sources/ircmaxell/php-types/lib/PHPTypes/TypeReconstructor.php). The php-cfg / lib/Compiler.php lowering from #3802 is unreachable until PHPTypes accepts the op.

This blocks #4137 (JIT) and #4041 (AOT) — both assume VM compile already works.

php-src reference

Repro (failure today)

<?php
// ternary arm
echo (false ? 1 : throw new LogicException('x'));

// assignment (PHP 8.0+)
$x = throw new Exception('e');
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "echo (false ? 1 : throw new LogicException(\"x\"));"'
# parseAndCompile failure: Unknown variable op found: Expr_Throw

Zend PHP 8+: uncaught exception / non-zero exit (never a compile abort).

Scope (this repo)

Layer Path Work
Vendor patch patches/php-types-*.patch, script/apply-patches.sh add Expr_Throw case (return never / bottom type)
Prelinked prelinked/bootstrap-vendor/ regenerate after patch
Compiler lib/Compiler.php verify compileThrowExpression still wired (#3802)
Tests test/compliance/cases/language/throw_expression*.phpt VM must execute before JIT work

PHP-in-PHP first — no new runtime/*.c branches.

Done when

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 features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions