helly           Tue Mar 16 05:18:00 2004 EDT

  Modified files:              
    /php-src/ext/spl    spl_iterators.c 
  Log:
  Make use of zend_make_printable_zval() instead of 'manually' calling
  __toString().
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.26&r2=1.27&ty=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.26 php-src/ext/spl/spl_iterators.c:1.27
--- php-src/ext/spl/spl_iterators.c:1.26        Tue Mar  9 12:35:18 2004
+++ php-src/ext/spl/spl_iterators.c     Tue Mar 16 05:17:59 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_iterators.c,v 1.26 2004/03/09 17:35:18 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.27 2004/03/16 10:17:59 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1054,15 +1054,18 @@
                        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);  

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to