diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-16 11:47:41 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-16 12:14:45 +0200 |
commit | f9a755d0d27eebd02fdeb9b1750aaca70b15f409 (patch) | |
tree | 614988fa36e579302da47a2480e1a650dfb909b8 /ext/standard/array.c | |
parent | 5ae49c43dc618ad373b88480a1662e480bd125fb (diff) | |
download | php-git-f9a755d0d27eebd02fdeb9b1750aaca70b15f409.tar.gz |
Fix HT flags copying wrt iterator count
HT_FLAGS() includes the full flag word, including the iterator
count. When we're fully reassigning it, we need to make sure that
we either really do want to copy the iterator count (as in some
cases in array.c) or we need to mask only the actual flag byte.
Add an assert to hash_iterators_del() to make sure the iterator
count is non-zero (which is how I ran into this) and make sure that
the iterator count is correctly preserved during array splicing.
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r-- | ext/standard/array.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 042f97726a..3c8723fca7 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -3138,6 +3138,7 @@ static void php_splice(HashTable *in_hash, zend_long offset, zend_long length, H } /* replace HashTable data */ + HT_SET_ITERATORS_COUNT(&out_hash, HT_ITERATORS_COUNT(in_hash)); HT_SET_ITERATORS_COUNT(in_hash, 0); in_hash->pDestructor = NULL; zend_hash_destroy(in_hash); |