cvs: ZendEngine2 / zend_objects.c

From: Date: Tue, 02 Mar 2004 08:13:16 +0000
Subject: cvs: ZendEngine2 / zend_objects.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2434@lists.php.net to get a copy of this message
andi Tue Mar 2 03:13:16 2004 EDT Modified files: /ZendEngine2 zend_objects.c Log: - Improve fix for protecting destructor's from exceptions. - I was killing the current exception completely which was wrong. http://cvs.php.net/diff.php/ZendEngine2/zend_objects.c?r1=1.46&r2=1.47&ty=u Index: ZendEngine2/zend_objects.c diff -u ZendEngine2/zend_objects.c:1.46 ZendEngine2/zend_objects.c:1.47 --- ZendEngine2/zend_objects.c:1.46 Mon Mar 1 14:45:07 2004 +++ ZendEngine2/zend_objects.c Tue Mar 2 03:13:15 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects.c,v 1.46 2004/03/01 19:45:07 andi Exp $ */ +/* $Id: zend_objects.c,v 1.47 2004/03/02 08:13:15 andi Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -32,6 +32,7 @@ if (destructor) { zval zobj, *obj = &zobj; + zval *old_exception; if (destructor->op_array.fn_flags & (ZEND_ACC_PRIVATE|ZEND_ACC_PROTECTED)) { if (destructor->op_array.fn_flags & ZEND_ACC_PRIVATE) { @@ -68,15 +69,17 @@ zobj.value.obj.handlers = &std_object_handlers; INIT_PZVAL(obj); - if (EG(exception)) { - zval_ptr_dtor(&EG(exception)); - EG(exception) = NULL; - } + /* Make sure that destructors are protected from previously thrown exceptions. + * For example, if an exception was thrown in a function and when the function's + * local variable destruction results in a destructor being called. + */ + old_exception = EG(exception); + EG(exception) = NULL; zend_call_method_with_0_params(&obj, object->ce, NULL, "__destruct", NULL); if (EG(exception)) { zval_ptr_dtor(&EG(exception)); - EG(exception) = NULL; } + EG(exception) = old_exception; } }

« previous php.zend-engine.cvs (#2434) next »