From: Stanislav Malyshev Date: Sun, 28 Mar 2004 12:06:10 +0000 (+0000) Subject: try get handler on printable conversion X-Git-Tag: php-5.0.0RC2RC1~194 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3b8b43a947931469116e992d50499d2b6fa9b690;p=php try get handler on printable conversion --- diff --git a/Zend/zend.c b/Zend/zend.c index 7497c153f0..5d177bd828 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -225,9 +225,19 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop zend_error(E_NOTICE, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name); } #endif - if (expr->value.obj.handlers->cast_object && - expr->value.obj.handlers->cast_object(expr, expr_copy, IS_STRING, 0 TSRMLS_CC) == SUCCESS) { - break; + if (Z_OBJ_HANDLER_P(expr, cast_object)) { + if(Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING, 0 TSRMLS_CC) == SUCCESS) { + break; + } + } else { + if(Z_OBJ_HANDLER_P(expr, get)) { + zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC); + if(Z_TYPE_P(z) != IS_OBJECT) { + zend_make_printable_zval(z, expr_copy, use_copy); + FREE_ZVAL(z); + return; + } + } } if (EG(exception)) { zval_dtor(expr_copy);