Browse Source

Fixed bug #67169: []= after_array_splice incorrect

This fixes a regression I introduced in beta 1.
pull/668/head
Nikita Popov 12 years ago
parent
commit
69b5ee61d0
  1. 4
      NEWS
  2. 26
      Zend/tests/bug67169.phpt
  3. 1
      Zend/zend_hash.c

4
NEWS

@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2014, PHP 5.6.0 Beta 3
- Core:
. Fixed bug #67169 (array_splice all elements, then []= gives wrong index).
(Nikita)
01 May 2014, PHP 5.6.0 Beta 2
- CLI server:

26
Zend/tests/bug67169.phpt

@ -0,0 +1,26 @@
--TEST--
Bug #67169: array_splice all elements, then []= gives wrong index
--FILE--
<?php
$array = array('a', 'b');
array_splice($array, 0, 2);
$array[] = 'c';
var_dump($array);
$array = array('a', 'b');
array_shift($array);
array_shift($array);
$array[] = 'c';
var_dump($array);
?>
--EXPECT--
array(1) {
[0]=>
string(1) "c"
}
array(1) {
[0]=>
string(1) "c"
}

1
Zend/zend_hash.c

@ -487,6 +487,7 @@ ZEND_API void zend_hash_reindex(HashTable *ht, zend_bool only_integer_keys) {
IS_CONSISTENT(ht);
if (UNEXPECTED(ht->nNumOfElements == 0)) {
ht->nNextFreeElement = 0;
return;
}

Loading…
Cancel
Save