File tree Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ PHP NEWS
3131 values). (dstogov, nielsdos, ilutov)
3232 . Fix bug GH-10935 (Use of trait doesn't redeclare static property if class
3333 has inherited it from its parent). (ilutov)
34+ . Fix bug GH-11154 (Negative indices on empty array don't affect next chosen
35+ index). (ColinHDev)
3436
3537- Date:
3638 . Implement More Appropriate Date/Time Exceptions RFC. (Derick)
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ PHP 8.3 UPGRADE NOTES
3939 inherited from the parent class. This will create a separate static property
4040 storage for the current class. This is analogous to adding the static
4141 property to the class directly without traits.
42+ . Assigning a negative index n to an empty array will now make sure that the
43+ next index is n+1 instead of 0.
4244
4345- FFI:
4446 . C functions that have a return type of void now return null instead of
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ ZEND_API const HashTable zend_empty_array = {
255255 .nNumOfElements = 0 ,
256256 .nTableSize = HT_MIN_SIZE ,
257257 .nInternalPointer = 0 ,
258- .nNextFreeElement = 0 ,
258+ .nNextFreeElement = ZEND_LONG_MIN ,
259259 .pDestructor = ZVAL_PTR_DTOR
260260};
261261
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Test empty arrays with first added index being negative
3+ --FILE--
4+ <?php
5+
6+ $ a = [];
7+ $ a [-5 ] = "-5 " ;
8+ $ a [] = "after -5 " ;
9+
10+ var_dump ($ a );
11+ ?>
12+ --EXPECT--
13+ array(2) {
14+ [-5]=>
15+ string(2) "-5"
16+ [-4]=>
17+ string(8) "after -5"
18+ }
You can’t perform that action at this time.
0 commit comments