From: Marcus Boerger Date: Tue, 16 Mar 2004 10:17:59 +0000 (+0000) Subject: Make use of zend_make_printable_zval() instead of 'manually' calling X-Git-Tag: php-5.0.0RC1RC2~34 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=426649067c27efd09499d3be9ddb828086d05fcb;p=php Make use of zend_make_printable_zval() instead of 'manually' calling __toString(). --- diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index dc20bdb5ac..143ff9f6b6 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1054,15 +1054,18 @@ static INLINE void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC) zval_ptr_dtor(&retval); } if (intern->u.caching.flags & CIT_CALL_TOSTRING) { - zend_class_entry *ce_data = spl_get_class_entry(intern->current.data TSRMLS_CC); - if (ce_data && zend_hash_exists(&ce_data->function_table, "__tostring", sizeof("__tostring"))) { - zend_call_method_with_0_params(&intern->current.data, ce_data, NULL, "__tostring", &intern->u.caching.zstr); + int use_copy; + zval expr_copy; + ALLOC_ZVAL(intern->u.caching.zstr); + *intern->u.caching.zstr = *intern->current.data; + zend_make_printable_zval(intern->u.caching.zstr, &expr_copy, &use_copy); + if (use_copy) { + *intern->u.caching.zstr = expr_copy; + INIT_PZVAL(intern->u.caching.zstr); + zval_copy_ctor(intern->u.caching.zstr); + zval_dtor(&expr_copy); } else { - ALLOC_ZVAL(intern->u.caching.zstr); - *intern->u.caching.zstr = *intern->current.data; zval_copy_ctor(intern->u.caching.zstr); - INIT_PZVAL(intern->u.caching.zstr); - convert_to_string(intern->u.caching.zstr); } } spl_dual_it_next(intern, 0 TSRMLS_CC);