]> granicus.if.org Git - php/commitdiff
- Fixed bug #49734 (toString must return string value)
authorFelipe Pena <felipe@php.net>
Thu, 12 Nov 2009 23:18:04 +0000 (23:18 +0000)
committerFelipe Pena <felipe@php.net>
Thu, 12 Nov 2009 23:18:04 +0000 (23:18 +0000)
Zend/zend_object_handlers.c

index 19050061ecc43559426232ed468516425730127f..8058c5dbb2195cf413333358f2952db5930478d8 100644 (file)
@@ -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);