mirror of
https://github.com/php/php-src.git
synced 2024-12-15 04:45:03 +08:00
- Fix memleak, Zend's built-in functions get copied before we copy all
functions, thus ending up in the name and param definitions copied twice because zend_register_funciton already copies them. - Also Be able to deallocate Zend's built-in functions and do so when appropriate. - After unregistering Zend's built-in functions only dl() is left and that seems to be fine.
This commit is contained in:
parent
b9b83ec794
commit
aea4ea120f
@ -1045,7 +1045,7 @@ static void unicode_globals_dtor(zend_unicode_globals *unicode_globals TSRMLS_DC
|
||||
|
||||
void zend_init_opcodes_handlers(void);
|
||||
|
||||
int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions) /* {{{ */
|
||||
int zend_startup(zend_utility_functions *utility_functions, char **extensions) /* {{{ */
|
||||
{
|
||||
#ifdef ZTS
|
||||
zend_compiler_globals *compiler_globals;
|
||||
@ -1170,10 +1170,6 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
|
||||
zend_init_exception_op(TSRMLS_C);
|
||||
#endif
|
||||
|
||||
if (start_builtin_functions) {
|
||||
zend_startup_builtin_functions(TSRMLS_C);
|
||||
}
|
||||
|
||||
zend_ini_startup(TSRMLS_C);
|
||||
|
||||
#ifdef ZTS
|
||||
@ -1209,6 +1205,7 @@ void zend_register_standard_ini_entries(TSRMLS_D) /* {{{ */
|
||||
ucnv_close(UG(runtime_encoding_conv));
|
||||
UG(runtime_encoding_conv) = old_runtime_encoding_conv;
|
||||
}
|
||||
zend_startup_builtin_functions(TSRMLS_C);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1248,6 +1245,7 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
|
||||
#endif
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
zend_hash_graceful_reverse_destroy(&module_registry);
|
||||
zend_shutdown_builtin_functions(TSRMLS_C);
|
||||
|
||||
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
|
||||
zend_hash_destroy(GLOBAL_CLASS_TABLE);
|
||||
|
@ -572,7 +572,7 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
|
||||
/* default engine string type */
|
||||
#define ZEND_STR_TYPE (UG(unicode) ? IS_UNICODE : IS_STRING)
|
||||
|
||||
int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions);
|
||||
int zend_startup(zend_utility_functions *utility_functions, char **extensions);
|
||||
void zend_shutdown(TSRMLS_D);
|
||||
void zend_register_standard_ini_entries(TSRMLS_D);
|
||||
void zend_post_startup(TSRMLS_D);
|
||||
|
@ -416,6 +416,12 @@ int zend_startup_builtin_functions(TSRMLS_D) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_shutdown_builtin_functions(TSRMLS_D) /* {{{ */
|
||||
{
|
||||
zend_unregister_functions(builtin_functions, -1, NULL TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string zend_version(void) U
|
||||
Get the version of the Zend Engine */
|
||||
ZEND_FUNCTION(zend_version)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define ZEND_BUILTIN_FUNCTIONS_H
|
||||
|
||||
int zend_startup_builtin_functions(TSRMLS_D);
|
||||
int zend_shutdown_builtin_functions(TSRMLS_D);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int provide_object TSRMLS_DC);
|
||||
|
@ -1838,7 +1838,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
||||
zuf.vspprintf_function = vspprintf;
|
||||
zuf.getenv_function = sapi_getenv;
|
||||
zuf.resolve_path_function = php_resolve_path_for_zend;
|
||||
zend_startup(&zuf, NULL, 1);
|
||||
zend_startup(&zuf, NULL);
|
||||
|
||||
#ifdef ZTS
|
||||
executor_globals = ts_resource(executor_globals_id);
|
||||
|
Loading…
Reference in New Issue
Block a user