Skip to content

Commit 7b2f216

Browse files
committed
Fixed memory leaks in ext/standard/tests/array/shuffle_basic2.phpt
without opcache.
1 parent 55c0091 commit 7b2f216

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ext/standard/array.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2876,6 +2876,18 @@ static void php_array_data_shuffle(zval *array) /* {{{ */
28762876
n_left = n_elems;
28772877

28782878
if (!HT_IS_PACKED(hash)) {
2879+
if (!HT_HAS_STATIC_KEYS_ONLY(hash)) {
2880+
Bucket *p = hash->arData;
2881+
uint32_t i = hash->nNumUsed;
2882+
2883+
for (; i > 0; p++, i--) {
2884+
if (Z_ISUNDEF(p->val)) continue;
2885+
if (p->key) {
2886+
zend_string_release(p->key);
2887+
p->key = NULL;
2888+
}
2889+
}
2890+
}
28792891
zend_hash_to_packed(hash);
28802892
}
28812893

0 commit comments

Comments
 (0)