File tree 4 files changed +23
-1
lines changed
4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ PHP NEWS
31
31
values). (dstogov, nielsdos, ilutov)
32
32
. Fix bug GH-10935 (Use of trait doesn't redeclare static property if class
33
33
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)
34
36
35
37
- Date:
36
38
. 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
39
39
inherited from the parent class. This will create a separate static property
40
40
storage for the current class. This is analogous to adding the static
41
41
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.
42
44
43
45
- FFI:
44
46
. 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 = {
255
255
.nNumOfElements = 0 ,
256
256
.nTableSize = HT_MIN_SIZE ,
257
257
.nInternalPointer = 0 ,
258
- .nNextFreeElement = 0 ,
258
+ .nNextFreeElement = ZEND_LONG_MIN ,
259
259
.pDestructor = ZVAL_PTR_DTOR
260
260
};
261
261
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