Skip to content

Commit 5b01b74

Browse files
committed
async: a pending exception still fails zend_execute_script under a scheduler
Reporting stays deferred until after the scheduler drain, but the return value now says FAILURE, so an uncaught exception in auto_prepend_file stops the prepend/main/append chain like it does without a scheduler instead of silently running the primary script with EG(exception) set.
1 parent fb91696 commit 5b01b74

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Zend/zend.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,8 +1982,14 @@ ZEND_API zend_result zend_execute_script(int type, zval *retval, zend_file_handl
19821982
zend_user_exception_handler();
19831983
}
19841984

1985-
if (EG(exception) && ZEND_ASYNC_CURRENT_COROUTINE == NULL) {
1986-
ret = zend_exception_error(EG(exception), E_ERROR);
1985+
if (EG(exception)) {
1986+
if (ZEND_ASYNC_CURRENT_COROUTINE == NULL) {
1987+
ret = zend_exception_error(EG(exception), E_ERROR);
1988+
} else {
1989+
/* Report after the scheduler drain, but still break the
1990+
* prepend/main/append chain. */
1991+
ret = FAILURE;
1992+
}
19871993
}
19881994
}
19891995
zend_destroy_static_vars(op_array);

0 commit comments

Comments
 (0)