From: Felipe Pena Date: Thu, 12 Nov 2009 23:18:04 +0000 (+0000) Subject: - Fixed bug #49734 (toString must return string value) X-Git-Tag: php-5.4.0alpha1~191^2~2400 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e87ae0b388da138e010bc392276f646122a73c03;p=php - Fixed bug #49734 (toString must return string value) --- diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 19050061ec..8058c5dbb2 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1253,7 +1253,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty zend_error(E_ERROR, "Method %v::__toString() must not throw an exception", ce->name); return FAILURE; } - if (Z_TYPE_P(retval) == IS_UNICODE) { + if (Z_TYPE_P(retval) == IS_UNICODE || Z_TYPE_P(retval) == IS_STRING) { INIT_PZVAL(writeobj); if (readobj == writeobj) { zval_dtor(readobj);