com php-src: zend_make_printable_zval choses cast_o bject over __toString: Zend/zend.c

From: Date: Fri, 10 Aug 2012 10:09:25 +0000
Subject: com php-src: zend_make_printable_zval choses cast_o bject over __toString: Zend/zend.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-69808@lists.php.net to get a copy of this message
Commit: a5dfd414941953c282bb68f6b08685252ca93a1a Author: Leigh <leight@gmail.com> Fri, 10 Aug 2012 11:09:25 +0100 Parents: 7e4c0125dac2167b13ff279d8213ee46be45d4c7 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a5dfd414941953c282bb68f6b08685252ca93a1a Log: zend_make_printable_zval choses cast_object over __toString https://bugs.php.net/bug.php?id=62328 Added a check to see if the object implements a __toString magic method. This should be called instead of the cast_object method of built-in classes when defined. Changed paths: M Zend/zend.c Diff: diff --git a/Zend/zend.c b/Zend/zend.c index 18c4f11..be30e92 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -258,6 +258,12 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop { TSRMLS_FETCH(); + if (Z_OBJCE_P(expr)->__tostring) { + if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { + break; + } + } + if (Z_OBJ_HANDLER_P(expr, cast_object)) { zval *val;

« previous php.cvs (#69808) next »