We must not forget to keep the `nNextFreeElement` when duplicating
empty arrays.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.17
+- Core:
+ . Fixed bug #79364 (When copy empty array, next key is unspecified). (cmb)
+
- Spl:
. Fixed bug #75673 (SplStack::unserialize() behavior). (cmb)
--- /dev/null
+--TEST--
+Bug #79364 (When copy empty array, next key is unspecified)
+--FILE--
+<?php
+$a = [1, 2];
+unset($a[1], $a[0]);
+$b = $a;
+
+$a[] = 3;
+$b[] = 4;
+
+var_dump($a, $b);
+?>
+--EXPECT--
+array(1) {
+ [2]=>
+ int(3)
+}
+array(1) {
+ [2]=>
+ int(4)
+}
target->nTableMask = HT_MIN_MASK;
target->nNumUsed = 0;
target->nNumOfElements = 0;
- target->nNextFreeElement = 0;
+ target->nNextFreeElement = source->nNextFreeElement;
target->nInternalPointer = 0;
HT_SET_DATA_ADDR(target, &uninitialized_bucket);
} else if (GC_FLAGS(source) & IS_ARRAY_IMMUTABLE) {