summaryrefslogtreecommitdiff
path: root/Zend/zend.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2008-04-17 10:21:38 +0000
committerDmitry Stogov <dmitry@php.net>2008-04-17 10:21:38 +0000
commitfcaa1c6d86b4a182913ada0429485fc9eb3a95bc (patch)
tree1e1113a4ffac532fdc4a6d915c3a530584dd5d97 /Zend/zend.c
parent683aa8d1cc1c3319d40dcdbc89417bda7ec6bd61 (diff)
downloadphp-git-fcaa1c6d86b4a182913ada0429485fc9eb3a95bc.tar.gz
Fixed bug #44226 (Throwing an exception causes crash in multithreaded SAPI)
Diffstat (limited to 'Zend/zend.c')
-rw-r--r--Zend/zend.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index b6329e9b7c..c2cb9b4da9 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -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) {