com php-src: Fixed bug #69758 (Item added to array not being removed by array_pop/shift): NEWS Zend/tests/bug69758 .phpt Zend/zend_hash.c

From: Date: Fri, 05 Jun 2015 03:54:22 +0000
Subject: com php-src: Fixed bug #69758 (Item added to array not being removed by array_pop/shift): NEWS Zend/tests/bug69758 .phpt Zend/zend_hash.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87069@lists.php.net to get a copy of this message
Commit: 497f9f2cda4e2f2281cfbde148e7408908261c63 Author: Xinchen Hui <laruence@php.net> Fri, 5 Jun 2015 11:54:22 +0800 Parents: c6db18f9ab0f512df573bca9538f1aace9a1a6d2 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=497f9f2cda4e2f2281cfbde148e7408908261c63 Log: Fixed bug #69758 (Item added to array not being removed by array_pop/shift) Bugs: https://bugs.php.net/69758 Changed paths: M NEWS A Zend/tests/bug69758.phpt M Zend/zend_hash.c Diff: diff --git a/NEWS b/NEWS index 81242d1..ecd70bb 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 0000000...f0b3588 --- /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-- +<?php +$tokens = array(); +$conditions = array(); +for ($i = 0; $i <= 10; $i++) { + $tokens[$i] = $conditions; + + // First integer must be less than 8 + // and second must be 8, 9 or 10 + if ($i !== 0 && $i !== 8) { + continue; + } + + // Add condition and then pop off straight away. + // Can also use array_shift() here. + $conditions[$i] = true; + $oldCondition = array_pop($conditions); +} + +// Conditions should be empty. +var_dump($conditions); +?> +--EXPECT-- +array(0) { +} diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 76804b0..bb0a2ff 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;

« previous php.cvs (#87069) next »