com php-src: Fixed #69166 (Assigning array_values() to array does not reset key counter): Zend/zend _hash.h ext/standard/tests/array/bug69166.php t

From: Date: Tue, 03 Mar 2015 09:31:20 +0000
Subject: com php-src: Fixed #69166 (Assigning array_values() to array does not reset key counter): Zend/zend _hash.h ext/standard/tests/array/bug69166.php t
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-85166@lists.php.net to get a copy of this message
Commit: 70bd500645da48f3c2eb2ebbe916a2abe51a48e0 Author: Xinchen Hui <laruence@php.net> Tue, 3 Mar 2015 17:07:49 +0800 Parents: a78998c48b062f119d9a0f1c941b85dc8733b429 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=70bd500645da48f3c2eb2ebbe916a2abe51a48e0 Log: Fixed #69166 (Assigning array_values() to array does not reset key counter) Bugs: https://bugs.php.net/69166 Changed paths: M Zend/zend_hash.h A ext/standard/tests/array/bug69166.phpt Diff: diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index afa3602..30e0453 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -795,7 +795,7 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, #define ZEND_HASH_FILL_END() \ __fill_ht->nNumUsed = __fill_idx; \ __fill_ht->nNumOfElements = __fill_idx; \ - __fill_ht->nNextFreeElement = __fill_idx + 1; \ + __fill_ht->nNextFreeElement = __fill_idx; \ __fill_ht->nInternalPointer = 0; \ } while (0) diff --git a/ext/standard/tests/array/bug69166.phpt b/ext/standard/tests/array/bug69166.phpt new file mode 100644 index 0000000..d0b5fad --- /dev/null +++ b/ext/standard/tests/array/bug69166.phpt @@ -0,0 +1,17 @@ +--TEST-- +Fixed #69166 (Assigning array_values() to array does not reset key counter) +--FILE-- +<?php + +$array = [0]; +$ar = array_values($array); +$ar[] = 1; +var_dump($ar); +?> +--EXPECT-- +array(2) { + [0]=> + int(0) + [1]=> + int(1) +}

« previous php.cvs (#85166) next »