mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix incorrect HASH_FLAG_HAS_EMPTY_IND flag on userland array
This commit is contained in:
2
NEWS
2
NEWS
@@ -10,6 +10,8 @@ PHP NEWS
|
|||||||
exception are triggered). (nielsdos)
|
exception are triggered). (nielsdos)
|
||||||
. Fixed bug GH-19653 (Closure named argument unpacking between temporary
|
. Fixed bug GH-19653 (Closure named argument unpacking between temporary
|
||||||
closures can cause a crash). (nielsdos, Arnaud, Bob)
|
closures can cause a crash). (nielsdos, Arnaud, Bob)
|
||||||
|
. Fixed bug GH-19839 (Incorrect HASH_FLAG_HAS_EMPTY_IND flag on userland
|
||||||
|
array). (ilutov)
|
||||||
|
|
||||||
- Curl:
|
- Curl:
|
||||||
. Fix cloning of CURLOPT_POSTFIELDS when using the clone operator instead
|
. Fix cloning of CURLOPT_POSTFIELDS when using the clone operator instead
|
||||||
|
|||||||
18
Zend/tests/gh19839.phpt
Normal file
18
Zend/tests/gh19839.phpt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
--TEST--
|
||||||
|
GH-19839: Incorrect HASH_FLAG_HAS_EMPTY_IND flag on userland array
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
const X = 'x';
|
||||||
|
|
||||||
|
$x = null;
|
||||||
|
unset(${X});
|
||||||
|
|
||||||
|
$a = $GLOBALS;
|
||||||
|
sort($a);
|
||||||
|
serialize($a);
|
||||||
|
|
||||||
|
?>
|
||||||
|
===DONE===
|
||||||
|
--EXPECT--
|
||||||
|
===DONE===
|
||||||
@@ -2465,6 +2465,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
|
|||||||
target->nTableSize = HT_MIN_SIZE;
|
target->nTableSize = HT_MIN_SIZE;
|
||||||
HT_SET_DATA_ADDR(target, &uninitialized_bucket);
|
HT_SET_DATA_ADDR(target, &uninitialized_bucket);
|
||||||
} else if (GC_FLAGS(source) & IS_ARRAY_IMMUTABLE) {
|
} else if (GC_FLAGS(source) & IS_ARRAY_IMMUTABLE) {
|
||||||
|
ZEND_ASSERT(!(HT_FLAGS(source) & HASH_FLAG_HAS_EMPTY_IND));
|
||||||
HT_FLAGS(target) = HT_FLAGS(source) & HASH_FLAG_MASK;
|
HT_FLAGS(target) = HT_FLAGS(source) & HASH_FLAG_MASK;
|
||||||
target->nTableMask = source->nTableMask;
|
target->nTableMask = source->nTableMask;
|
||||||
target->nNumUsed = source->nNumUsed;
|
target->nNumUsed = source->nNumUsed;
|
||||||
@@ -2481,6 +2482,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
|
|||||||
memcpy(HT_GET_DATA_ADDR(target), HT_GET_DATA_ADDR(source), HT_USED_SIZE(source));
|
memcpy(HT_GET_DATA_ADDR(target), HT_GET_DATA_ADDR(source), HT_USED_SIZE(source));
|
||||||
}
|
}
|
||||||
} else if (HT_IS_PACKED(source)) {
|
} else if (HT_IS_PACKED(source)) {
|
||||||
|
ZEND_ASSERT(!(HT_FLAGS(source) & HASH_FLAG_HAS_EMPTY_IND));
|
||||||
HT_FLAGS(target) = HT_FLAGS(source) & HASH_FLAG_MASK;
|
HT_FLAGS(target) = HT_FLAGS(source) & HASH_FLAG_MASK;
|
||||||
target->nTableMask = HT_MIN_MASK;
|
target->nTableMask = HT_MIN_MASK;
|
||||||
target->nNumUsed = source->nNumUsed;
|
target->nNumUsed = source->nNumUsed;
|
||||||
@@ -2500,7 +2502,8 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
|
|||||||
zend_array_dup_packed_elements(source, target, 1);
|
zend_array_dup_packed_elements(source, target, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
HT_FLAGS(target) = HT_FLAGS(source) & HASH_FLAG_MASK;
|
/* Indirects are removed during duplication, remove HASH_FLAG_HAS_EMPTY_IND accordingly. */
|
||||||
|
HT_FLAGS(target) = HT_FLAGS(source) & (HASH_FLAG_MASK & ~HASH_FLAG_HAS_EMPTY_IND);
|
||||||
target->nTableMask = source->nTableMask;
|
target->nTableMask = source->nTableMask;
|
||||||
target->nNextFreeElement = source->nNextFreeElement;
|
target->nNextFreeElement = source->nNextFreeElement;
|
||||||
target->nInternalPointer =
|
target->nInternalPointer =
|
||||||
|
|||||||
Reference in New Issue
Block a user