diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | Zend/zend.c | 51 | ||||
-rw-r--r-- | Zend/zend_compile.h | 1 | ||||
-rw-r--r-- | sapi/phpdbg/create-test.php | 4 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_prompt.c | 2 |
5 files changed, 36 insertions, 25 deletions
@@ -28,6 +28,9 @@ PHP NEWS . Require at least OpenSSL version 0.9.8. (Jakub Zelenka) . Fixed bug #68312 (Lookup for openssl.cnf causes a message box). (Anatol) +- Phpdbg: + . Fixed bug #70532 (phpdbg must respect set_exception_handler). (Bob) + - Session: . Fixed bug #70529 (Session read causes "String is not zero-terminated" error). (Yasuo) diff --git a/Zend/zend.c b/Zend/zend.c index 0a70ccc3b5..2934f4a075 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1379,6 +1379,32 @@ ZEND_API ZEND_COLD void zend_output_debug_string(zend_bool trigger_break, const } /* }}} */ +ZEND_API void zend_try_exception_handler() /* {{{ */ +{ + 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)); + + if (call_user_function_ex(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params, 1, NULL) == SUCCESS) { + zval_ptr_dtor(&retval2); + if (EG(exception)) { + OBJ_RELEASE(EG(exception)); + EG(exception) = NULL; + } + OBJ_RELEASE(old_exception); + } else { + EG(exception) = old_exception; + } + } + } +} /* }}} */ + ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */ { va_list files; @@ -1401,30 +1427,9 @@ 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)) { - 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)); - - if (call_user_function_ex(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params, 1, NULL) == SUCCESS) { - zval_ptr_dtor(&retval2); - if (EG(exception)) { - OBJ_RELEASE(EG(exception)); - EG(exception) = NULL; - } - OBJ_RELEASE(old_exception); - } else { - EG(exception) = old_exception; - zend_exception_error(EG(exception), E_ERROR); - } - } else { - zend_exception_error(EG(exception), E_ERROR); - } + zend_exception_error(EG(exception), E_ERROR); } destroy_op_array(op_array); efree_size(op_array, sizeof(zend_op_array)); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 06c7d02149..ee4fbe5a73 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -725,6 +725,7 @@ ZEND_API void function_add_ref(zend_function *function); ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type); ZEND_API zend_op_array *compile_string(zval *source_string, char *filename); ZEND_API zend_op_array *compile_filename(int type, zval *filename); +ZEND_API void zend_try_exception_handler(); ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...); ZEND_API int open_file_for_scanning(zend_file_handle *file_handle); ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size); diff --git a/sapi/phpdbg/create-test.php b/sapi/phpdbg/create-test.php index 6de10bd56f..5dc1ba48bb 100644 --- a/sapi/phpdbg/create-test.php +++ b/sapi/phpdbg/create-test.php @@ -98,11 +98,11 @@ stream_set_blocking(STDIN, true); print "\n"; if (!isset($name)) { - print "Specifiy the test description: "; + print "Specify the test description: "; $desc = trim(fgets(STDIN)); } while (!isset($testfile)) { - print "Specifiy the test file name (leave empty to write to stderr): "; + print "Specify the test file name (leave empty to write to stderr): "; $testfile = trim(fgets(STDIN)); if ($testfile != "" && file_exists($testfile)) { print "That file already exists. Type y or yes to overwrite: "; diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index cacfe932aa..0314d39f24 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -744,6 +744,8 @@ PHPDBG_COMMAND(run) /* {{{ */ } if (restore) { + zend_exception_restore(); + zend_try_exception_handler(); if (EG(exception)) { phpdbg_handle_exception(); } |