From be6f9c2bb5b068be0b6d96c245bd248828f80c05 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Mon, 17 Mar 2008 15:05:28 +0000 Subject: [PATCH] return empty string of correct type if __toString() returned invalid value --- Zend/zend_object_handlers.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 04f0a62ea6..21c77f3824 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1260,7 +1260,11 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty if (readobj == writeobj) { zval_dtor(readobj); } - ZVAL_EMPTY_STRING(writeobj); + if (type == IS_UNICODE) { + ZVAL_EMPTY_UNICODE(writeobj); + } else { + ZVAL_EMPTY_STRING(writeobj); + } zend_error(E_RECOVERABLE_ERROR, "Method %v::__toString() must return a string value", ce->name); return SUCCESS; } -- 2.50.1