1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00

Fixed bug #44226 (Throwing an exception causes crash in multithreaded SAPI)

This commit is contained in:
Dmitry Stogov
2008-04-17 10:21:38 +00:00
parent 683aa8d1cc
commit fcaa1c6d86
2 changed files with 24 additions and 17 deletions
+24
View File
@@ -28,6 +28,7 @@
#include "zend_exceptions.h"
#include "zend_builtin_functions.h"
#include "zend_ini.h"
#include "zend_vm.h"
#ifdef ZTS
# define GLOBAL_FUNCTION_TABLE global_function_table
@@ -463,6 +464,27 @@ static void zend_set_default_compile_time_values(TSRMLS_D) /* {{{ */
}
/* }}} */
static void zend_init_exception_op(TSRMLS_D) /* {{{ */
{
memset(EG(exception_op), 0, sizeof(EG(exception_op)));
EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION;
EG(exception_op)[0].op1.op_type = IS_UNUSED;
EG(exception_op)[0].op2.op_type = IS_UNUSED;
EG(exception_op)[0].result.op_type = IS_UNUSED;
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op));
EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION;
EG(exception_op)[1].op1.op_type = IS_UNUSED;
EG(exception_op)[1].op2.op_type = IS_UNUSED;
EG(exception_op)[1].result.op_type = IS_UNUSED;
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1);
EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION;
EG(exception_op)[2].op1.op_type = IS_UNUSED;
EG(exception_op)[2].op2.op_type = IS_UNUSED;
EG(exception_op)[2].result.op_type = IS_UNUSED;
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2);
}
/* }}} */
#ifdef ZTS
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC) /* {{{ */
{
@@ -522,6 +544,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
zend_startup_constants(TSRMLS_C);
zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
zend_init_rsrc_plist(TSRMLS_C);
zend_init_exception_op(TSRMLS_C);
EG(lambda_count) = 0;
EG(user_error_handler) = NULL;
EG(user_exception_handler) = NULL;
@@ -680,6 +703,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
#ifndef ZTS
zend_init_rsrc_plist(TSRMLS_C);
zend_init_exception_op(TSRMLS_C);
#endif
if (start_builtin_functions) {
-17
View File
@@ -568,23 +568,6 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */
{
zend_class_entry ce;
memset(EG(exception_op), 0, sizeof(EG(exception_op)));
EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION;
EG(exception_op)[0].op1.op_type = IS_UNUSED;
EG(exception_op)[0].op2.op_type = IS_UNUSED;
EG(exception_op)[0].result.op_type = IS_UNUSED;
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op));
EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION;
EG(exception_op)[1].op1.op_type = IS_UNUSED;
EG(exception_op)[1].op2.op_type = IS_UNUSED;
EG(exception_op)[1].result.op_type = IS_UNUSED;
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1);
EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION;
EG(exception_op)[2].op1.op_type = IS_UNUSED;
EG(exception_op)[2].op2.op_type = IS_UNUSED;
EG(exception_op)[2].result.op_type = IS_UNUSED;
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2);
INIT_CLASS_ENTRY(ce, "Exception", default_exception_functions);
default_exception_ce = zend_register_internal_class(&ce TSRMLS_CC);
default_exception_ce->create_object = zend_default_exception_new;