mirror of
https://github.com/php/php-src.git
synced 2024-11-29 12:53:37 +08:00
Unicode support for dl() patch.
This commit is contained in:
parent
c09bbfa2b8
commit
34c493ea07
@ -260,6 +260,7 @@ struct _sapi_module_struct {
|
||||
int phpinfo_as_text;
|
||||
|
||||
char *ini_entries;
|
||||
zend_function_entry *additional_functions;
|
||||
};
|
||||
|
||||
|
||||
|
32
main/main.c
32
main/main.c
@ -1680,6 +1680,17 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
||||
/* start Zend extensions */
|
||||
zend_startup_extensions();
|
||||
|
||||
/* register additional functions */
|
||||
if (sapi_module.additional_functions) {
|
||||
zend_module_entry *module;
|
||||
|
||||
if (zend_hash_find(&module_registry, "standard", sizeof("standard"), (void**)&module)==SUCCESS) {
|
||||
EG(current_module) = module;
|
||||
zend_register_functions(NULL, sapi_module.additional_functions, NULL, MODULE_PERSISTENT TSRMLS_CC);
|
||||
EG(current_module) = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
UG(unicode) = orig_unicode;
|
||||
zend_post_startup(TSRMLS_C);
|
||||
|
||||
@ -1692,27 +1703,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_enable_dl
|
||||
*/
|
||||
int php_enable_dl()
|
||||
{
|
||||
zend_module_entry *module;
|
||||
static zend_function_entry dl_functions[] = {
|
||||
ZEND_FE(dl, NULL)
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
int ret = FAILURE;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (zend_hash_find(&module_registry, "standard", sizeof("standard"), (void**)&module)==SUCCESS) {
|
||||
EG(current_module) = module;
|
||||
ret = zend_register_functions(NULL, dl_functions, NULL, MODULE_PERSISTENT TSRMLS_CC);
|
||||
EG(current_module) = NULL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void php_module_shutdown_for_exec()
|
||||
{
|
||||
/* used to close fd's in the range 3.255 here, but it's problematic */
|
||||
|
@ -55,9 +55,6 @@ extern void php_free_shutdown_functions(TSRMLS_D);
|
||||
extern int php_init_environ(void);
|
||||
extern int php_shutdown_environ(void);
|
||||
|
||||
/* dl() support */
|
||||
PHPAPI int php_enable_dl(void);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif
|
||||
|
@ -468,8 +468,7 @@ static int sapi_cgi_deactivate(TSRMLS_D)
|
||||
|
||||
static int php_cgi_startup(sapi_module_struct *sapi_module)
|
||||
{
|
||||
if (php_module_startup(sapi_module, NULL, 0) == FAILURE ||
|
||||
php_enable_dl() == FAILURE) {
|
||||
if (php_module_startup(sapi_module, NULL, 0) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -510,6 +509,11 @@ static sapi_module_struct cgi_sapi_module = {
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
static zend_function_entry additional_functions[] = {
|
||||
ZEND_FE(dl, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* {{{ php_cgi_usage
|
||||
*/
|
||||
static void php_cgi_usage(char *argv0)
|
||||
@ -1003,10 +1007,10 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
cgi_sapi_module.executable_location = argv[0];
|
||||
cgi_sapi_module.additional_functions = additional_functions;
|
||||
|
||||
/* startup after we get the above ini override se we get things right */
|
||||
if (php_module_startup(&cgi_sapi_module, NULL, 0) == FAILURE ||
|
||||
php_enable_dl() == FAILURE) {
|
||||
if (php_module_startup(&cgi_sapi_module, NULL, 0) == FAILURE) {
|
||||
#ifdef ZTS
|
||||
tsrm_shutdown();
|
||||
#endif
|
||||
|
@ -328,8 +328,7 @@ static void sapi_cli_send_header(sapi_header_struct *sapi_header, void *server_c
|
||||
|
||||
static int php_cli_startup(sapi_module_struct *sapi_module)
|
||||
{
|
||||
if (php_module_startup(sapi_module, NULL, 0)==FAILURE ||
|
||||
php_enable_dl()==FAILURE) {
|
||||
if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -391,6 +390,11 @@ static sapi_module_struct cli_sapi_module = {
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
static zend_function_entry additional_functions[] = {
|
||||
ZEND_FE(dl, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* {{{ php_cli_usage
|
||||
*/
|
||||
static void php_cli_usage(char *argv0)
|
||||
@ -672,6 +676,7 @@ int main(int argc, char *argv[])
|
||||
php_optarg = orig_optarg;
|
||||
|
||||
cli_sapi_module.executable_location = argv[0];
|
||||
cli_sapi_module.additional_functions = additional_functions;
|
||||
|
||||
#ifdef ZTS
|
||||
compiler_globals = ts_resource(compiler_globals_id);
|
||||
@ -682,8 +687,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
/* startup after we get the above ini override se we get things right */
|
||||
if (php_module_startup(&cli_sapi_module, NULL, 0)==FAILURE ||
|
||||
php_enable_dl()==FAILURE) {
|
||||
if (php_module_startup(&cli_sapi_module, NULL, 0)==FAILURE) {
|
||||
/* there is no way to see if we must call zend_ini_deactivate()
|
||||
* since we cannot check if EG(ini_directives) has been initialised
|
||||
* because the executor's constructor does not set initialize it.
|
||||
|
@ -93,8 +93,7 @@ static void php_embed_register_variables(zval *track_vars_array TSRMLS_DC)
|
||||
|
||||
static int php_embed_startup(sapi_module_struct *sapi_module)
|
||||
{
|
||||
if (php_module_startup(sapi_module, NULL, 0)==FAILURE ||
|
||||
php_enable_dl()==FAILURE) {
|
||||
if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -132,6 +131,11 @@ sapi_module_struct php_embed_module = {
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
static zend_function_entry additional_functions[] = {
|
||||
ZEND_FE(dl, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
int php_embed_init(int argc, char **argv PTSRMLS_DC)
|
||||
{
|
||||
zend_llist global_vars;
|
||||
@ -174,6 +178,7 @@ int php_embed_init(int argc, char **argv PTSRMLS_DC)
|
||||
*ptsrm_ls = tsrm_ls;
|
||||
#endif
|
||||
|
||||
php_embed_module.additional_functions = additional_functions;
|
||||
sapi_startup(&php_embed_module);
|
||||
|
||||
if (php_embed_module.startup(&php_embed_module)==FAILURE) {
|
||||
|
Loading…
Reference in New Issue
Block a user