prepare v2.2.3
[m6w6/ext-pq] / src / php_pq_object.c
index 6d80a1f5547f68364ac86ff424e40eef0d0c2f03..5b3f217a95f7e7bb4c9561a7d954a34359787089 100644 (file)
@@ -103,11 +103,13 @@ static int apply_pi_to_ht(zval *p, void *a)
                zval zobj;
 
                ZVAL_OBJ(&zobj, &arg->pq_obj->zo);
+# if PHP_VERSION_ID < 70100
+               property = zend_read_property(arg->pq_obj->zo.ce, &zobj, pi->name->val, pi->name->len, 0, &tmp_prop);
+# else
                property = zend_read_property_ex(arg->pq_obj->zo.ce, &zobj, pi->name, 0, &tmp_prop);
-#elif PHP_VERSION_ID >= 70100
-               property = zend_read_property_ex(arg->pq_obj->zo.ce, &arg->pq_obj->zo, pi->name, 0, &tmp_prop);
+# endif
 #else
-               property = zend_read_property(arg->pq_obj->zo.ce, &arg->pq_obj->zo, pi->name->val, pi->name->len, 0, &tmp_prop);
+               property = zend_read_property_ex(arg->pq_obj->zo.ce, &arg->pq_obj->zo, pi->name, 0, &tmp_prop);
 #endif
                zend_hash_update(arg->ht, pi->name, property);
        }
@@ -174,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;