From: Andrei Zmievski Date: Wed, 12 Dec 2001 02:27:49 +0000 (+0000) Subject: Ack, apparently in statically linked-in extensions we have to clean the X-Git-Tag: ChangeLog~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=727ef4b94f067d86fe2276b240173b6507142f7e;p=php Ack, apparently in statically linked-in extensions we have to clean the hash of overloaded classes on request shutdown. Also, added some fold markers and rearranged some defines. --- diff --git a/ext/overload/overload.c b/ext/overload/overload.c index 128420c5ff..9f2bdc002d 100644 --- a/ext/overload/overload.c +++ b/ext/overload/overload.c @@ -50,6 +50,19 @@ #define SET_HANDLER "__set" #define CALL_HANDLER "__call" +#define DISABLE_HANDLERS(ce) \ + (ce).handle_property_get = NULL; \ + (ce).handle_property_set = NULL; \ + (ce).handle_function_call = NULL; + +typedef struct _oo_class_data { + void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference); + zval (*handle_property_get)(zend_property_reference *property_reference); + int (*handle_property_set)(zend_property_reference *property_reference, zval *value); + HashTable getters; + HashTable setters; +} oo_class_data; + ZEND_DECLARE_MODULE_GLOBALS(overload) function_entry overload_functions[] = { @@ -64,7 +77,7 @@ zend_module_entry overload_module_entry = { PHP_MINIT(overload), PHP_MSHUTDOWN(overload), NULL, - NULL, + PHP_RSHUTDOWN(overload), PHP_MINFO(overload), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES @@ -74,19 +87,6 @@ zend_module_entry overload_module_entry = { ZEND_GET_MODULE(overload) #endif -typedef struct _oo_class_data { - void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference); - zval (*handle_property_get)(zend_property_reference *property_reference); - int (*handle_property_set)(zend_property_reference *property_reference, zval *value); - HashTable getters; - HashTable setters; -} oo_class_data; - -#define DISABLE_HANDLERS(ce) \ - (ce).handle_property_get = NULL; \ - (ce).handle_property_set = NULL; \ - (ce).handle_function_call = NULL; - static void overloaded_class_dtor(oo_class_data *oo_data) { zend_hash_destroy(&oo_data->getters); @@ -96,8 +96,8 @@ static void overloaded_class_dtor(oo_class_data *oo_data) /* {{{ php_overload_init_globals */ static void php_overload_init_globals(zend_overload_globals *overload_globals TSRMLS_DC) { - zend_hash_init_ex(&overload_globals->overloaded_classes, 10, NULL, - (dtor_func_t)overloaded_class_dtor, 1, 0); + zend_hash_init(&overload_globals->overloaded_classes, 10, NULL, + (dtor_func_t)overloaded_class_dtor, 1); } /* }}} */ @@ -108,8 +108,7 @@ static void php_overload_destroy_globals(zend_overload_globals *overload_globals } /* }}} */ -/* {{{ PHP_MINIT_FUNCTION - */ +/* {{{ PHP_MINIT_FUNCTION(overload) */ PHP_MINIT_FUNCTION(overload) { ZEND_INIT_MODULE_GLOBALS(overload, php_overload_init_globals, php_overload_destroy_globals); @@ -121,6 +120,7 @@ PHP_MINIT_FUNCTION(overload) } /* }}} */ +/* {{{ PHP_MSHUTDOWN_FUNCTION(overload) */ PHP_MSHUTDOWN_FUNCTION(overload) { #ifdef ZTS @@ -131,9 +131,18 @@ PHP_MSHUTDOWN_FUNCTION(overload) return SUCCESS; } +/* }}} */ -/* {{{ PHP_MINFO_FUNCTION - */ +/* {{{ PHP_RSHUTDOWN_FUNCTION(overload) */ +PHP_RSHUTDOWN_FUNCTION(overload) +{ + zend_hash_clean(&OOG(overloaded_classes)); + + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(overload) { php_info_print_table_start(); diff --git a/ext/overload/php_overload.h b/ext/overload/php_overload.h index 6e08e1e3bb..b8838ae511 100644 --- a/ext/overload/php_overload.h +++ b/ext/overload/php_overload.h @@ -36,6 +36,7 @@ extern zend_module_entry overload_module_entry; PHP_MINIT_FUNCTION(overload); PHP_MSHUTDOWN_FUNCTION(overload); +PHP_RSHUTDOWN_FUNCTION(overload); PHP_MINFO_FUNCTION(overload); PHP_FUNCTION(overload);