mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Fixed bug #69758 (Item added to array not being removed by array_pop/shift)
This commit is contained in:
2
NEWS
2
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)
|
||||
|
||||
27
Zend/tests/bug69758.phpt
Normal file
27
Zend/tests/bug69758.phpt
Normal file
@@ -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) {
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user