gc: ignore recursive calls
authorMichael Wallner <mike@php.net>
Tue, 10 Aug 2021 07:14:12 +0000 (09:14 +0200)
committerMichael Wallner <mike@php.net>
Tue, 10 Aug 2021 07:14:12 +0000 (09:14 +0200)
src/php_pq_object.c

index c8d1e50bc73d4b1df3c119c48dabf396b4223e2e..5b3f217a95f7e7bb4c9561a7d954a34359787089 100644 (file)
@@ -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;