From: Marcus Boerger Date: Thu, 2 Mar 2006 00:40:19 +0000 (+0000) Subject: - Use object handler get in the same way as the rest of the engine does X-Git-Tag: RELEASE_1_2~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd35eae1aa47f63bc96b1733669a94c49b188ca0;p=php - Use object handler get in the same way as the rest of the engine does --- diff --git a/Zend/zend.c b/Zend/zend.c index e01263a5d3..5053ed22eb 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -358,16 +358,19 @@ ZEND_API void zend_make_string_zval(zval *expr, zval *expr_copy, int *use_copy) } if (Z_OBJ_HANDLER_P(expr, get)) { zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC); + + z->refcount++; if(Z_TYPE_P(z) != IS_OBJECT) { zend_make_string_zval(z, expr_copy, use_copy); if (*use_copy) { - FREE_ZVAL(z); + zval_ptr_dtor(&z); } else { ZVAL_ZVAL(expr_copy, z, 0, 1); *use_copy = 1; } return; } + zval_ptr_dtor(&z); } zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %v could not be converted to string", Z_OBJCE_P(expr)->name); ZVAL_EMPTY_STRING(expr_copy); @@ -424,16 +427,19 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop } if (Z_OBJ_HANDLER_P(expr, get)) { zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC); + + z->refcount++; if(Z_TYPE_P(z) != IS_OBJECT) { zend_make_printable_zval(z, expr_copy, use_copy); if (*use_copy) { - FREE_ZVAL(z); + zval_ptr_dtor(&z); } else { ZVAL_ZVAL(expr_copy, z, 0, 1); *use_copy = 1; } return; } + zval_ptr_dtor(&z); } zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %v could not be converted to string", Z_OBJCE_P(expr)->name); ZVAL_EMPTY_STRING(expr_copy); @@ -473,16 +479,19 @@ ZEND_API void zend_make_unicode_zval(zval *expr, zval *expr_copy, int *use_copy) } if (Z_OBJ_HANDLER_P(expr, get)) { zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC); + + z->refcount++; if(Z_TYPE_P(z) != IS_OBJECT) { zend_make_unicode_zval(z, expr_copy, use_copy); if (*use_copy) { - FREE_ZVAL(z); + zval_ptr_dtor(&z); } else { ZVAL_ZVAL(expr_copy, z, 0, 1); *use_copy = 1; } return; } + zval_ptr_dtor(&z); } zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %v could not be converted to string", Z_OBJCE_P(expr)->name); ZVAL_EMPTY_UNICODE(expr_copy);