From 3b8b43a947931469116e992d50499d2b6fa9b690 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 28 Mar 2004 12:06:10 +0000 Subject: [PATCH] try get handler on printable conversion --- Zend/zend.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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); -- 2.40.0