Skip to content

Language: throw expressions and Exception object propagation #195

Description

@PurHur

Category

language | runtime

Problem (May 2026 status)

#57 landed VM/JIT try/catch/finally lowering, but throw new Exception(...) still fails because built-in exception classes are not registered in the VM class table. User code cannot instantiate Exception, Error, or Throwable for validation / HTTP error paths.

MiniWebApp and #697 contact validation will need real exception objects, not only string throws.

php-src reference

Repro (failure today)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r '"'"'try { throw new Exception("x"); } catch (Exception $e) { echo $e->getMessage(); }'"'"''

Expected (Zend): x
Actual:

LogicException: Attempting to instantiate non-existing class Exception
  in lib/VM.php (TYPE_NEW)

Uncaught path (after class exists):

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r '"'"'throw new Exception("boom");'"'"''
# expect non-zero exit / uncaught handler

Scope (this repo)

Done when

Dependencies

Verification

./script/ci-fast.sh --filter exception_throw

Docker: ./script/docker-exec.sh — not raw docker run -v "$(pwd):/compiler".

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: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