mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
Fixed bug #72116 (7.0.6 array_fill optimization breaks implementation)
This commit is contained in:
parent
595d19bcfa
commit
74ef863f5d
1
NEWS
1
NEWS
@ -51,6 +51,7 @@ PHP NEWS
|
|||||||
(Laruence)
|
(Laruence)
|
||||||
. Fixed bug #72031 (array_column() against an array of objects discards all
|
. Fixed bug #72031 (array_column() against an array of objects discards all
|
||||||
values matching null). (Nikita)
|
values matching null). (Nikita)
|
||||||
|
. Fixed bug #72116 (array_fill optimization breaks implementation). (Bob)
|
||||||
|
|
||||||
28 Apr 2016 PHP 7.0.6
|
28 Apr 2016 PHP 7.0.6
|
||||||
|
|
||||||
|
@ -2029,6 +2029,7 @@ PHP_FUNCTION(array_fill)
|
|||||||
Z_ARRVAL_P(return_value)->nNumUsed = start_key + num;
|
Z_ARRVAL_P(return_value)->nNumUsed = start_key + num;
|
||||||
Z_ARRVAL_P(return_value)->nNumOfElements = num;
|
Z_ARRVAL_P(return_value)->nNumOfElements = num;
|
||||||
Z_ARRVAL_P(return_value)->nInternalPointer = start_key;
|
Z_ARRVAL_P(return_value)->nInternalPointer = start_key;
|
||||||
|
Z_ARRVAL_P(return_value)->nNextFreeElement = start_key + num;
|
||||||
|
|
||||||
if (Z_REFCOUNTED_P(val)) {
|
if (Z_REFCOUNTED_P(val)) {
|
||||||
GC_REFCOUNT(Z_COUNTED_P(val)) += num;
|
GC_REFCOUNT(Z_COUNTED_P(val)) += num;
|
||||||
|
18
ext/standard/tests/array/bug72116.phpt
Normal file
18
ext/standard/tests/array/bug72116.phpt
Normal 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"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user