cvs: ZendEngine2(PHP_5_2) / zend_object_handlers.c
| From: | Marcus Boerger | Date: | Wed, 10 May 2006 21:12:48 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_2) / zend_object_handlers.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4853@lists.php.net to get a copy of this message | ||
helly Wed May 10 21:12:48 2006 UTC
Modified files: (Branch: PHP_5_2)
/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.135.2.6.2.1&r2=1.135.2.6.2.2&diff_format=u
Index: ZendEngine2/zend_object_handlers.c
diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.1
ZendEngine2/zend_object_handlers.c:1.135.2.6.2.2
--- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.1 Tue May 9 23:53:23 2006
+++ ZendEngine2/zend_object_handlers.c Wed May 10 21:12:48 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_object_handlers.c,v 1.135.2.6.2.1 2006/05/09 23:53:23 helly Exp $ */
+/* $Id: zend_object_handlers.c,v 1.135.2.6.2.2 2006/05/10 21:12:48 helly Exp $ */
#include "zend.h"
#include "zend_globals.h"
@@ -1034,9 +1034,11 @@
case IS_STRING:
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);
+ if (retval) {
+ zval_ptr_dtor(&retval);
+ }
zend_error(E_ERROR, "Method %s::__toString() must not throw an exception",
ce->name);
return FAILURE;
}