tony2001 Fri Apr 7 22:53:34 2006 UTC Modified files: /php-src/ext/spl spl_array.c Log: MF51: fix memory corruptions and leaks when cloning ArrayObjects and ArrayIterators http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_array.c?r1=1.109&r2=1.110&diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.109 php-src/ext/spl/spl_array.c:1.110 --- php-src/ext/spl/spl_array.c:1.109 Mon Apr 3 19:58:03 2006 +++ php-src/ext/spl/spl_array.c Fri Apr 7 22:53:34 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.109 2006/04/03 19:58:03 helly Exp $ */ +/* $Id: spl_array.c,v 1.110 2006/04/07 22:53:34 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -149,10 +149,12 @@ if (clone_orig) { intern->array = other->array; if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayObject) { - ZVAL_ADDREF(intern->array); - SEPARATE_ZVAL(&intern->array); + MAKE_STD_ZVAL(intern->array); + array_init(intern->array); + zend_hash_copy(HASH_OF(intern->array), HASH_OF(other->array), (copy_ctor_func_t) zval_add_ref, &tmp, sizeof(zval*)); + } + if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator) { ZVAL_ADDREF(other->array); - ZVAL_ADDREF(intern->array); } } else { intern->array = orig;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php