]> granicus.if.org Git - php/commitdiff
Unicode support for dl() patch.
authorDmitry Stogov <dmitry@php.net>
Fri, 17 Mar 2006 13:45:43 +0000 (13:45 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 17 Mar 2006 13:45:43 +0000 (13:45 +0000)
main/SAPI.h
main/main.c
main/php_main.h
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c
sapi/embed/php_embed.c

index 9abf29b0fc61c61fd95a1b8e701b87074ef3c9d7..6fa66db6fdf054e99647fe01e1137b9069ac0ded 100644 (file)
@@ -260,6 +260,7 @@ struct _sapi_module_struct {
        int phpinfo_as_text;
 
        char *ini_entries;
+       zend_function_entry *additional_functions;
 };
 
 
index b0c6246815c62a60cd1af56349a26ddcd58d37de..0ea62ffffe6389ccc14897a9fb4dd557ffb700ae 100644 (file)
@@ -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 */
index 3560f91941bcb53ffe3c83cf4f2330a086986e61..27b725133e7320797202855fb653f6c484b3482c 100644 (file)
@@ -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
index d9ac678686770bbecd2a849187b89494c12e9109..b8633c751cf48a04eed08b55f99f36391e9e2089 100644 (file)
@@ -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
index 2248e3d776af09863284b063da86f87deae79cc6..864975414caa323ec496e154385ccb36e0d064c3 100644 (file)
@@ -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.
index ec9476e6e9413f53c8274988643778b931a5ac14..9ed446b84021030be4c780e17b0304a90cd5353f 100644 (file)
@@ -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) {