cvs: ZendEngine2(PHP_5_2) / zend_objects.c

From: Date: Sat, 20 May 2006 21:02:44 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_objects.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4914@lists.php.net to get a copy of this message
helly Sat May 20 21:02:44 2006 UTC Modified files: (Branch: PHP_5_2) /ZendEngine2 zend_objects.c Log: - MFH Improved error message http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_objects.c?r1=1.56.2.3.2.1&r2=1.56.2.3.2.2&diff_format=u Index: ZendEngine2/zend_objects.c diff -u ZendEngine2/zend_objects.c:1.56.2.3.2.1 ZendEngine2/zend_objects.c:1.56.2.3.2.2 --- ZendEngine2/zend_objects.c:1.56.2.3.2.1 Tue May 9 23:53:23 2006 +++ ZendEngine2/zend_objects.c Sat May 20 21:02:44 2006 @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ @@ -17,13 +17,14 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects.c,v 1.56.2.3.2.1 2006/05/09 23:53:23 helly Exp $ */ +/* $Id: zend_objects.c,v 1.56.2.3.2.2 2006/05/20 21:02:44 helly Exp $ */ #include "zend.h" #include "zend_globals.h" #include "zend_variables.h" #include "zend_API.h" #include "zend_interfaces.h" +#include "zend_exceptions.h" ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC) { @@ -53,7 +54,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) { /* Ensure that if we're calling a private function, we're allowed to do so. @@ -84,9 +85,9 @@ } } - zobj.type = IS_OBJECT; - zobj.value.obj.handle = handle; - zobj.value.obj.handlers = &std_object_handlers; + Z_TYPE(zobj) = IS_OBJECT; + Z_OBJ_HANDLE(zobj) = handle; + Z_OBJ_HT(zobj) = &std_object_handlers; INIT_PZVAL(obj); /* Make sure that destructors are protected from previously thrown exceptions. @@ -95,10 +96,15 @@ */ old_exception = EG(exception); EG(exception) = NULL; - zend_call_method_with_0_params(&obj, object->ce, &object->ce->destructor, ZEND_DESTRUCTOR_FUNC_NAME, NULL); + zend_call_method_with_0_params(&obj, object->ce, &destructor, ZEND_DESTRUCTOR_FUNC_NAME, NULL); if (old_exception) { if (EG(exception)) { - zend_error(E_ERROR, "Ignoring exception from %s::__destruct() while an exception is already active", object->ce->name); + zend_class_entry *default_exception_ce = zend_exception_get_default(TSRMLS_C); + zval *file = zend_read_property(default_exception_ce, old_exception, "file", sizeof("file")-1, 1 TSRMLS_CC); + zval *line = zend_read_property(default_exception_ce, old_exception, "line", sizeof("line")-1, 1 TSRMLS_CC); + + zend_error(E_ERROR, "Ignoring exception from %s::__destruct() while an exception is already active (Uncaught %s in %s on line %ld)", + object->ce->name, Z_OBJCE_P(old_exception)->name, Z_STRVAL_P(file), Z_LVAL_P(line)); zval_ptr_dtor(&EG(exception)); } EG(exception) = old_exception;

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