From 7074c710d3374eea1a81ed5ef5299f2d724c4497 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 10 Aug 2021 09:14:12 +0200 Subject: [PATCH] gc: ignore recursive calls --- src/php_pq_object.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; -- 2.30.2