static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC);
static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC);
+static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC);
static HashTable *date_object_get_properties(zval *object TSRMLS_DC);
+static HashTable *date_object_get_gc_interval(zval *object, zval ***table, int *n TSRMLS_DC);
static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC);
zval *date_interval_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC);
date_object_handlers_date.clone_obj = date_object_clone_date;
date_object_handlers_date.compare_objects = date_object_compare_date;
date_object_handlers_date.get_properties = date_object_get_properties;
+ date_object_handlers_date.get_gc = date_object_get_gc;
#define REGISTER_DATE_CLASS_CONST_STRING(const_name, value) \
zend_declare_class_constant_stringl(date_ce_date, const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC);
date_object_handlers_interval.write_property = date_interval_write_property;
date_object_handlers_interval.get_properties = date_object_get_properties_interval;
date_object_handlers_interval.get_property_ptr_ptr = NULL;
+ date_object_handlers_interval.get_gc = date_object_get_gc_interval;
INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period);
ce_period.create_object = date_object_new_period;
return 1;
}
+static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC)
+{
+ *table = NULL;
+ *n = 0;
+ return zend_std_get_properties(object TSRMLS_CC);
+}
+
static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
{
HashTable *props;
props = zend_std_get_properties(object TSRMLS_CC);
- if (!dateobj->time || GC_G(gc_active)) {
+ if (!dateobj->time) {
return props;
}
return new_ov;
}
+static HashTable *date_object_get_gc_interval(zval *object, zval ***table, int *n TSRMLS_DC)
+{
+
+ *table = NULL;
+ *n = 0;
+ return zend_std_get_properties(object TSRMLS_CC);
+}
+
static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
{
HashTable *props;
props = zend_std_get_properties(object TSRMLS_CC);
- if (!intervalobj->initialized || GC_G(gc_active)) {
+ if (!intervalobj->initialized) {
return props;
}
zend_hash_init(rv, 0, NULL, ZVAL_PTR_DTOR, 0);
}
else if (sxe->properties) {
- if (GC_G(gc_active)) {
- return sxe->properties;
- }
zend_hash_clean(sxe->properties);
rv = sxe->properties;
} else {
- if (GC_G(gc_active)) {
- return NULL;
- }
ALLOC_HASHTABLE(rv);
zend_hash_init(rv, 0, NULL, ZVAL_PTR_DTOR, 0);
sxe->properties = rv;
}
/* }}} */
+static HashTable * sxe_get_gc(zval *object, zval ***table, int *n TSRMLS_DC) /* {{{ */ {
+ php_sxe_object *sxe;
+ sxe = php_sxe_fetch_object(object TSRMLS_CC);
+
+ *table = NULL;
+ *n = 0;
+ return sxe->properties;
+}
+/* }}} */
+
static HashTable * sxe_get_properties(zval *object TSRMLS_DC) /* {{{ */
{
return sxe_get_prop_hash(object, 0 TSRMLS_CC);
sxe_objects_compare,
sxe_object_cast,
sxe_count_elements,
- sxe_get_debug_info
+ sxe_get_debug_info,
+ NULL,
+ sxe_get_gc
};
/* }}} */
/* }}} */
/* overriden for garbage collection
- * This is very hacky, but unfortunately the garbage collector can only query objects for
- * dependencies through get_properties */
-static HashTable *spl_object_storage_get_properties(zval *obj TSRMLS_DC) /* {{{ */
+ * This is very hacky */
+static HashTable *spl_object_storage_get_gc(zval *obj, zval ***table, int *n TSRMLS_DC) /* {{{ */
{
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(obj TSRMLS_CC);
spl_SplObjectStorageElement *element;
props = std_object_handlers.get_properties(obj TSRMLS_CC);
- if (!GC_G(gc_active)) {
- zend_hash_del(props, "\x00gcdata", sizeof("\x00gcdata"));
- return props;
- }
-
- if (props->nApplyCount > 0) {
- return props;
- }
+ *table = NULL;
+ *n = 0;
/* clean \x00gcdata, as it may be out of date */
if (zend_hash_find(props, "\x00gcdata", sizeof("\x00gcdata"), (void**) &gcdata_arr_pp) == SUCCESS) {
REGISTER_SPL_STD_CLASS_EX(SplObjectStorage, spl_SplObjectStorage_new, spl_funcs_SplObjectStorage);
memcpy(&spl_handler_SplObjectStorage, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- spl_handler_SplObjectStorage.get_properties = spl_object_storage_get_properties;
spl_handler_SplObjectStorage.get_debug_info = spl_object_storage_debug_info;
spl_handler_SplObjectStorage.compare_objects = spl_object_storage_compare_objects;
spl_handler_SplObjectStorage.clone_obj = spl_object_storage_clone;
+ spl_handler_SplObjectStorage.get_gc = spl_object_storage_get_gc;
REGISTER_SPL_IMPLEMENTS(SplObjectStorage, Countable);
REGISTER_SPL_IMPLEMENTS(SplObjectStorage, Iterator);