From 497f9f2cda4e2f2281cfbde148e7408908261c63 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 5 Jun 2015 11:54:22 +0800 Subject: [PATCH] Fixed bug #69758 (Item added to array not being removed by array_pop/shift) --- NEWS | 2 ++ Zend/tests/bug69758.phpt | 27 +++++++++++++++++++++++++++ Zend/zend_hash.c | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/bug69758.phpt diff --git a/NEWS b/NEWS index 81242d12a8..ecd70bba9d 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ . Added support for SEARCH WebDav method. (Mats Lindh) - Core: + . Fixed bug #69758 (Item added to array not being removed by array_pop/shift + ). (Laruence) . Fixed bug #68475 (Add support for $callable() sytnax with 'Class::method'). (Julien, Aaron Piotrowski) . Fixed bug #69485 (Double free on zend_list_dtor). (Laruence) diff --git a/Zend/tests/bug69758.phpt b/Zend/tests/bug69758.phpt new file mode 100644 index 0000000000..f0b3588139 --- /dev/null +++ b/Zend/tests/bug69758.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #69758 (Item added to array not being removed by array_pop/shift) +--FILE-- + +--EXPECT-- +array(0) { +} diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 76804b0ab5..bb0a2ff24a 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -1698,7 +1698,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source) target->pDestructor = source->pDestructor; if (source->nNumUsed == 0) { - target->u.flags = (source->u.flags & ~(HASH_FLAG_INITIALIZED|HASH_FLAG_PERSISTENT)) | HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_STATIC_KEYS; + target->u.flags = (source->u.flags & ~(HASH_FLAG_INITIALIZED|HASH_FLAG_PACKED|HASH_FLAG_PERSISTENT)) | HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_STATIC_KEYS; target->nTableMask = HT_MIN_MASK; target->nNumUsed = 0; target->nNumOfElements = 0; -- 2.40.0