diff options
author | Dmitry Stogov <dmitry@zend.com> | 2019-05-31 12:22:08 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2019-05-31 12:22:08 +0300 |
commit | b4a3b49eab1fd2ab2e3e47157c06c3dce0b9ba44 (patch) | |
tree | afc87829d17c93a11343c9dbfdd3cbc707ac6921 /Zend/zend.c | |
parent | 0f337e901b15cc8f5ac3a794afdf46c34cbdd3c8 (diff) | |
parent | 1df9f238fed314255b858e3996c35be8cdff917f (diff) | |
download | php-git-b4a3b49eab1fd2ab2e3e47157c06c3dce0b9ba44.tar.gz |
Merge branch 'PHP-7.4'
* PHP-7.4:
Better hot/cold code splitting
Diffstat (limited to 'Zend/zend.c')
-rw-r--r-- | Zend/zend.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index fceaae62e4..d71be2266f 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1390,7 +1390,7 @@ static ZEND_COLD void zend_error_va_list( } /* }}} */ -static void get_filename_lineno(int type, const char **filename, uint32_t *lineno) { +static ZEND_COLD void get_filename_lineno(int type, const char **filename, uint32_t *lineno) { /* Obtain relevant filename and lineno */ switch (type) { case E_CORE_ERROR: @@ -1580,29 +1580,25 @@ ZEND_API ZEND_COLD void zend_output_debug_string(zend_bool trigger_break, const } /* }}} */ -ZEND_API void zend_try_exception_handler() /* {{{ */ +ZEND_API ZEND_COLD void zend_user_exception_handler(void) /* {{{ */ { - if (EG(exception)) { - if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) { - zval orig_user_exception_handler; - zval params[1], retval2; - zend_object *old_exception; - old_exception = EG(exception); - EG(exception) = NULL; - ZVAL_OBJ(¶ms[0], old_exception); - ZVAL_COPY_VALUE(&orig_user_exception_handler, &EG(user_exception_handler)); + zval orig_user_exception_handler; + zval params[1], retval2; + zend_object *old_exception; + old_exception = EG(exception); + EG(exception) = NULL; + ZVAL_OBJ(¶ms[0], old_exception); + ZVAL_COPY_VALUE(&orig_user_exception_handler, &EG(user_exception_handler)); - if (call_user_function(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params) == SUCCESS) { - zval_ptr_dtor(&retval2); - if (EG(exception)) { - OBJ_RELEASE(EG(exception)); - EG(exception) = NULL; - } - OBJ_RELEASE(old_exception); - } else { - EG(exception) = old_exception; - } + if (call_user_function(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params) == SUCCESS) { + zval_ptr_dtor(&retval2); + if (EG(exception)) { + OBJ_RELEASE(EG(exception)); + EG(exception) = NULL; } + OBJ_RELEASE(old_exception); + } else { + EG(exception) = old_exception; } } /* }}} */ @@ -1628,9 +1624,13 @@ ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) / if (op_array) { zend_execute(op_array, retval); zend_exception_restore(); - zend_try_exception_handler(); - if (EG(exception)) { - zend_exception_error(EG(exception), E_ERROR); + if (UNEXPECTED(EG(exception))) { + if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) { + zend_user_exception_handler(); + } + if (EG(exception)) { + zend_exception_error(EG(exception), E_ERROR); + } } destroy_op_array(op_array); efree_size(op_array, sizeof(zend_op_array)); |