cvs: ZendEngine2(PHP_5_3) / zend.c zend_exceptions.c
[email protected] ("Dmitry Stogov")
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvsdmitry1208427698@cvsserver> |
dmitry Thu Apr 17 10:21:38 2008 UTC
Modified files: (Branch: PHP_5_3)
/ZendEngine2 zend.c zend_exceptions.c
Log:
Fixed bug #44226 (Throwing an exception causes crash in multithreaded SAPI)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.c?r1=1.308.2.12.2.35.2.16&r2=1.308.2.12.2.35.2.17&diff_format=u
Index: ZendEngine2/zend.c
diff -u ZendEngine2/zend.c:1.308.2.12.2.35.2.16 ZendEngine2/zend.c:1.308.2.12.2.35.2.17
--- ZendEngine2/zend.c:1.308.2.12.2.35.2.16 Fri Apr 11 09:43:27 2008
+++ ZendEngine2/zend.c Thu Apr 17 10:21:38 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend.c,v 1.308.2.12.2.35.2.16 2008/04/11 09:43:27 dmitry Exp $ */
+/* $Id: zend.c,v 1.308.2.12.2.35.2.17 2008/04/17 10:21:38 dmitry Exp $ */
#include "zend.h"
#include "zend_extensions.h"
@@ -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_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 @@
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 @@
#ifndef ZTS
zend_init_rsrc_plist(TSRMLS_C);
+ zend_init_exception_op(TSRMLS_C);
#endif
if (start_builtin_functions) {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_exceptions.c?r1=1.79.2.6.2.9.2.5&r2=1.79.2.6.2.9.2.6&diff_format=u
Index: ZendEngine2/zend_exceptions.c
diff -u ZendEngine2/zend_exceptions.c:1.79.2.6.2.9.2.5 ZendEngine2/zend_exceptions.c:1.79.2.6.2.9.2.6
--- ZendEngine2/zend_exceptions.c:1.79.2.6.2.9.2.5 Mon Mar 10 22:02:41 2008
+++ ZendEngine2/zend_exceptions.c Thu Apr 17 10:21:38 2008
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_exceptions.c,v 1.79.2.6.2.9.2.5 2008/03/10 22:02:41 felipe Exp $ */
+/* $Id: zend_exceptions.c,v 1.79.2.6.2.9.2.6 2008/04/17 10:21:38 dmitry Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -568,23 +568,6 @@
{
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;