Skip to content

Commit 2839bf8

Browse files
committed
fix
1 parent f5a800b commit 2839bf8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ext-src/swoole_thread.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,12 +777,19 @@ void ZendArray::index_offsetUnset(zend_long index) {
777777
zend_long i = index;
778778
zend_long n = zend_hash_num_elements(&ht);
779779
HT_FLAGS(&ht) |= HASH_FLAG_PACKED | HASH_FLAG_STATIC_KEYS;
780-
while (i < n) {
780+
ArrayItem *item = (ArrayItem *) zend_hash_index_find_ptr(&ht, index);
781+
delete item;
782+
while (i < n - 1) {
783+
#if PHP_VERSION_ID >= 80200
784+
Z_PTR(ht.arPacked[i]) = Z_PTR(ht.arPacked[i + 1]);
785+
#else
781786
Z_PTR(ht.arData[i].val) = Z_PTR(ht.arData[i + 1].val);
787+
#endif
782788
i++;
783789
}
784790
ht.nNumUsed--;
785791
ht.nNumOfElements--;
792+
ht.nNextFreeElement--;
786793
lock_.unlock();
787794
}
788795

0 commit comments

Comments
 (0)