diff --git a/Zend/tests/gh11821.phpt b/Zend/tests/gh11821.phpt new file mode 100644 index 000000000000..4e34dbe2b4d5 --- /dev/null +++ b/Zend/tests/gh11821.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-11821: Exit in autoloader during class fetch should not cause UnwindExit string conversion error +--FILE-- + +--EXPECT-- diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 30eb6ec8af3d..b1a7f6befc5e 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1719,6 +1719,12 @@ static ZEND_COLD void report_class_fetch_error(zend_string *class_name, uint32_t } if (EG(exception)) { + if (EG(exception) == (void *)(uintptr_t)-1) { + return; + } + if (zend_is_unwind_exit(EG(exception)) || zend_is_graceful_exit(EG(exception))) { + return; + } if (!(fetch_type & ZEND_FETCH_CLASS_EXCEPTION)) { zend_exception_uncaught_error("During class fetch"); }