From: Michael Wallner Date: Tue, 10 Aug 2021 07:14:12 +0000 (+0200) Subject: gc: ignore recursive calls X-Git-Tag: v2.2.0~6 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=commitdiff_plain;h=7074c710d3374eea1a81ed5ef5299f2d724c4497;hp=9e81713ca24fd13c907c4e75b6da8e1f1e5d09f6 gc: ignore recursive calls --- diff --git a/src/php_pq_object.c b/src/php_pq_object.c index c8d1e50..5b3f217 100644 --- a/src/php_pq_object.c +++ b/src/php_pq_object.c @@ -176,9 +176,11 @@ static inline HashTable *php_pq_object_get_gc_ex(zend_object *object, HashTable arg.ht = &arg.pq_obj->gc; arg.gc = 1; - zend_hash_clean(arg.ht); - zend_hash_copy(arg.ht, props, NULL); - zend_hash_apply_with_argument(&arg.pq_obj->zo.ce->properties_info, apply_pi_to_ht, &arg); + if (GC_REFCOUNT(arg.ht) == 1) { + zend_hash_clean(arg.ht); + zend_hash_copy(arg.ht, props, NULL); + zend_hash_apply_with_argument(&arg.pq_obj->zo.ce->properties_info, apply_pi_to_ht, &arg); + } *table = NULL; *n = 0;