php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #63681
Patch bug63681.patch revision 2012-12-04 05:33 UTC by laruence@php.net

Patch bug63681.patch for SPL related Bug #63681

Patch version 2012-12-04 05:33 UTC

Return to Bug #63681 | Download this patch
Patch Revisions:

Developer: laruence@php.net

diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 4b8be82..5fed74b 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -361,28 +361,19 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp TSRMLS_D
 /* }}} */
 
 /* 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;
 	HashTable *props;
 	HashPosition pos;
-	zval *gcdata_arr = NULL,
-		 **gcdata_arr_pp;
+	zval *gcdata_arr = NULL, **gcdata_arr_pp;
 
-	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;
 
+	props = std_object_handlers.get_properties(obj TSRMLS_CC);
 	/* clean \x00gcdata, as it may be out of date */
 	if (zend_hash_find(props, "\x00gcdata", sizeof("\x00gcdata"), (void**) &gcdata_arr_pp) == SUCCESS) {
 		gcdata_arr = *gcdata_arr_pp;
@@ -1316,10 +1307,10 @@ PHP_MINIT_FUNCTION(spl_observer)
 	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);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 21:01:28 2024 UTC