File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #79364 (When copy empty array, next key is unspecified)
3
+ --FILE--
4
+ <?php
5
+ $ a = [1 , 2 ];
6
+ unset($ a [1 ], $ a [0 ]);
7
+ $ b = $ a ;
8
+
9
+ $ a [] = 3 ;
10
+ $ b [] = 4 ;
11
+
12
+ var_dump ($ a , $ b );
13
+ ?>
14
+ --EXPECT--
15
+ array(1) {
16
+ [2]=>
17
+ int(3)
18
+ }
19
+ array(1) {
20
+ [2]=>
21
+ int(4)
22
+ }
Original file line number Diff line number Diff line change @@ -2058,7 +2058,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
2058
2058
target -> nTableMask = HT_MIN_MASK ;
2059
2059
target -> nNumUsed = 0 ;
2060
2060
target -> nNumOfElements = 0 ;
2061
- target -> nNextFreeElement = ZEND_LONG_MIN ;
2061
+ target -> nNextFreeElement = source -> nNextFreeElement ;
2062
2062
target -> nInternalPointer = 0 ;
2063
2063
target -> nTableSize = HT_MIN_SIZE ;
2064
2064
HT_SET_DATA_ADDR (target , & uninitialized_bucket );
You can’t perform that action at this time.
0 commit comments