diff options
author | Marcus Boerger <helly@php.net> | 2006-05-10 21:12:48 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2006-05-10 21:12:48 +0000 |
commit | f16bdce2844bc4523d6fb804b1102f429da1a4e8 (patch) | |
tree | 10ea9cec99ea40377e53cb52ca9ebcf1eae85e19 | |
parent | cbb11e018a4aad1693adf81f5e85de77cb1e2438 (diff) | |
download | php-git-f16bdce2844bc4523d6fb804b1102f429da1a4e8.tar.gz |
- Enforece rule of disallowing throw in __toString()
-rw-r--r-- | Zend/zend_object_handlers.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 1f57ecf851..5e2894a198 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1034,9 +1034,11 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty 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; } |