forked from ircmaxell/php-compiler
-
Notifications
You must be signed in to change notification settings - Fork 1
Language: throw expressions and Exception object propagation #195
Copy link
Copy link
Closed
Labels
area:compilerCompiler / CFG / JITCompiler / CFG / JITarea:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language featuresPhase 2 – language features
Description
Activity
Metadata
Metadata
Assignees
Labels
area:compilerCompiler / CFG / JITCompiler / CFG / JITarea:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language featuresPhase 2 – language features
Category
language|runtimeProblem (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 instantiateException,Error, orThrowablefor validation / HTTP error paths.MiniWebApp and #697 contact validation will need real exception objects, not only string throws.
php-src reference
Zend/zend_exceptions.c—zend_throw_exception,zend_exception_get_default()Zend/zend_exceptions.h—zend_ce_exception,zend_ce_error,zend_ce_throwableext/standard/basic_functions.c—error_get_lastintegrationext/spl/spl_exceptions.c— SPL exception hierarchy (phase 2)Repro (failure today)
Expected (Zend):
xActual:
Uncaught path (after class exists):
Scope (this repo)
lib/VM/— register builtinException,Error,Throwable(minimal: message, code, file, line,getMessage())lib/Compiler.php—throwalready lowers; ensurecatch (Exception $e)type filter uses class entrylib/JIT/— JIT: try/catch/finally lowering phase 2 (#57, after VM #2084) #2114 phase 2 for full JIT exception objects; VM fallback acceptable v1bin/serve.php,lib/Web/— uncaught → HTTP 500 (Web: Map uncaught exceptions to HTTP 500 in serve driver #152 ✅ boundary)test/compliance/cases/exception_throw_caught.phpt,exception_throw_uncaught.phptDone when
xon VM$e->getMessage(),$e->getCode(),$e->getFile(),$e->getLine()match Zend for thrown exceptioncatch (Throwable $e)catchesExceptionandErrorsubclasses./script/ci-fast.sh --filter exception_throwgreenset_exception_handlercan receive object (follow-up if split)Dependencies
Verification
Docker:
./script/docker-exec.sh— not rawdocker run -v "$(pwd):/compiler".Links