@@ -2464,6 +2464,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(const HashTable *source)
24642464target -> nTableSize = HT_MIN_SIZE ;
24652465HT_SET_DATA_ADDR (target , & uninitialized_bucket );
24662466} else if (GC_FLAGS (source ) & IS_ARRAY_IMMUTABLE ) {
2467+ ZEND_ASSERT (!(HT_FLAGS (source ) & HASH_FLAG_HAS_EMPTY_IND ));
24672468HT_FLAGS (target ) = HT_FLAGS (source ) & HASH_FLAG_MASK ;
24682469target -> nTableMask = source -> nTableMask ;
24692470target -> nNumUsed = source -> nNumUsed ;
@@ -2480,6 +2481,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(const HashTable *source)
24802481memcpy (HT_GET_DATA_ADDR (target ), HT_GET_DATA_ADDR (source ), HT_USED_SIZE (source ));
24812482}
24822483} else if (HT_IS_PACKED (source )) {
2484+ ZEND_ASSERT (!(HT_FLAGS (source ) & HASH_FLAG_HAS_EMPTY_IND ));
24832485HT_FLAGS (target ) = HT_FLAGS (source ) & HASH_FLAG_MASK ;
24842486target -> nTableMask = HT_MIN_MASK ;
24852487target -> nNumUsed = source -> nNumUsed ;
@@ -2499,7 +2501,8 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(const HashTable *source)
24992501zend_array_dup_packed_elements (source , target , 1 );
25002502}
25012503} else {
2502- HT_FLAGS (target ) = HT_FLAGS (source ) & HASH_FLAG_MASK ;
2504+ /* Indirects are removed during duplication, remove HASH_FLAG_HAS_EMPTY_IND accordingly. */
2505+ HT_FLAGS (target ) = HT_FLAGS (source ) & (HASH_FLAG_MASK & ~HASH_FLAG_HAS_EMPTY_IND );
25032506target -> nTableMask = source -> nTableMask ;
25042507target -> nNextFreeElement = source -> nNextFreeElement ;
25052508target -> nInternalPointer =
0 commit comments