@@ -2464,6 +2464,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(const HashTable *source)
24642464 target -> nTableSize = HT_MIN_SIZE ;
24652465 HT_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 ));
24672468 HT_FLAGS (target ) = HT_FLAGS (source ) & HASH_FLAG_MASK ;
24682469 target -> nTableMask = source -> nTableMask ;
24692470 target -> nNumUsed = source -> nNumUsed ;
@@ -2480,6 +2481,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(const HashTable *source)
24802481 memcpy (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 ));
24832485 HT_FLAGS (target ) = HT_FLAGS (source ) & HASH_FLAG_MASK ;
24842486 target -> nTableMask = HT_MIN_MASK ;
24852487 target -> nNumUsed = source -> nNumUsed ;
@@ -2499,7 +2501,8 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(const HashTable *source)
24992501 zend_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 );
25032506 target -> nTableMask = source -> nTableMask ;
25042507 target -> nNextFreeElement = source -> nNextFreeElement ;
25052508 target -> nInternalPointer =
0 commit comments