cvs: ZendEngine2 / zend_object_handlers.c
| From: | Marcus Boerger | Date: | Wed, 10 May 2006 21:11:48 +0000 |
| Subject: | cvs: ZendEngine2 / zend_object_handlers.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4852@lists.php.net to get a copy of this message | ||
helly Wed May 10 21:11:48 2006 UTC
Modified files:
/ZendEngine2 zend_object_handlers.c
Log:
- Enforece rule of disallowing throw in __toString()
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_object_handlers.c?r1=1.162&r2=1.163&diff_format=u
Index: ZendEngine2/zend_object_handlers.c
diff -u ZendEngine2/zend_object_handlers.c:1.162 ZendEngine2/zend_object_handlers.c:1.163
--- ZendEngine2/zend_object_handlers.c:1.162 Tue May 9 21:26:39 2006
+++ ZendEngine2/zend_object_handlers.c Wed May 10 21:11:48 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_object_handlers.c,v 1.162 2006/05/09 21:26:39 helly Exp $ */
+/* $Id: zend_object_handlers.c,v 1.163 2006/05/10 21:11:48 helly Exp $ */
#include "zend.h"
#include "zend_globals.h"
@@ -1063,10 +1063,12 @@
case IS_UNICODE:
ce = Z_OBJCE_P(readobj);
if (ce->__tostring &&
- zend_call_method_with_0_params(&readobj, ce, &ce->__tostring,
"__tostring", &retval)) {
+ (zend_call_method_with_0_params(&readobj, ce, &ce->__tostring,
"__tostring", &retval) || EG(exception))) {
if (EG(exception)) {
- zval_ptr_dtor(&retval);
- zend_error(E_ERROR, "Method %v::__toString() must not throw an exception",
ce->name);
+ if (retval) {
+ zval_ptr_dtor(&retval);
+ }
+ zend_error(E_ERROR, "Method %s::__toString() must not throw an exception",
ce->name);
return FAILURE;
}
if (Z_TYPE_P(retval) == (UG(unicode)?IS_UNICODE:IS_STRING)) {