1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/standard/tests/array/negative_index_empty_array.phpt
ColinHDev e2f477c2cb Fix negative indices on empty array not affecting next chosen index
Changed the value of nNextFreeElement in _zend_empty_array from 0 to
ZEND_LONG_MIN.

Fixes GH-11154
Closes GH-11157
2023-05-02 12:05:48 +02:00

19 lines
224 B
PHP

--TEST--
Test empty arrays with first added index being negative
--FILE--
<?php
$a = [];
$a[-5] = "-5";
$a[] = "after -5";
var_dump($a);
?>
--EXPECT--
array(2) {
[-5]=>
string(2) "-5"
[-4]=>
string(8) "after -5"
}