From bb685a402f5ca873f1896640abacbb392e040157 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Fri, 1 Mar 2002 12:00:05 +0000 Subject: [PATCH] Fix php_splice() to work with large values --- ext/standard/array.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ext/standard/array.c b/ext/standard/array.c index d80ac32507..106ea8d23f 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1529,7 +1529,17 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length, and copy it into the output hash */ for (i=0; irefcount++; + if (entry->refcount>=1000) { + zval *tmp = (zval *) emalloc(sizeof(zval)); + + *tmp = *entry; + zval_copy_ctor(tmp); + tmp->refcount = 1; + tmp->is_ref = 0; + entry = tmp; + } else { + entry->refcount++; + } zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); } } -- 2.40.0