Fixed bug #72116 (7.0.6 array_fill optimization breaks implementation)

This commit is contained in:
Bob Weinand 2016-04-28 11:02:47 +02:00
parent 595d19bcfa
commit 74ef863f5d
3 changed files with 20 additions and 0 deletions

1
NEWS
View File

@ -51,6 +51,7 @@ PHP NEWS
(Laruence)
. Fixed bug #72031 (array_column() against an array of objects discards all
values matching null). (Nikita)
. Fixed bug #72116 (array_fill optimization breaks implementation). (Bob)
28 Apr 2016 PHP 7.0.6

View File

@ -2029,6 +2029,7 @@ PHP_FUNCTION(array_fill)
Z_ARRVAL_P(return_value)->nNumUsed = start_key + num;
Z_ARRVAL_P(return_value)->nNumOfElements = num;
Z_ARRVAL_P(return_value)->nInternalPointer = start_key;
Z_ARRVAL_P(return_value)->nNextFreeElement = start_key + num;
if (Z_REFCOUNTED_P(val)) {
GC_REFCOUNT(Z_COUNTED_P(val)) += num;

View File

@ -0,0 +1,18 @@
--TEST--
Bug #72116 (insertion after array_fill fails)
--FILE--
<?php
$x = array_fill(0, 1, '..');
$x[] = 'a';
var_dump($x);
?>
--EXPECT--
array(2) {
[0]=>
string(2) ".."
[1]=>
string(1) "a"
}