From: Nikita Popov Date: Mon, 22 Feb 2016 11:19:03 +0000 (+0100) Subject: Use USE_OTHER for ArrayIterator cloning X-Git-Tag: php-7.0.5RC1~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32e2801ff9878a928311a2d8a4599397a765c565;p=php Use USE_OTHER for ArrayIterator cloning intern->array should never be an array with refcount 2. --- diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 67d2ccb67c..83c1f288ff 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -170,7 +170,8 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval * ZVAL_ARR(&intern->array, zend_array_dup(HASH_OF(&other->array))); } else { ZEND_ASSERT(Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator); - ZVAL_COPY(&intern->array, &other->array); + ZVAL_COPY(&intern->array, orig); + intern->ar_flags |= SPL_ARRAY_USE_OTHER; } } else { ZVAL_COPY(&intern->array, orig);