]> granicus.if.org Git - php/commitdiff
MFH
authorMarcus Boerger <helly@php.net>
Wed, 31 Dec 2008 14:27:09 +0000 (14:27 +0000)
committerMarcus Boerger <helly@php.net>
Wed, 31 Dec 2008 14:27:09 +0000 (14:27 +0000)
- Changed dl() to be disabled by default. Enabled only when explicitly
  registered by the SAPI layer. Enabled only with CLI, CGI and EMBED. (Dmitry)
[DOC]

NEWS
ext/standard/basic_functions.c
main/SAPI.h
main/main.c
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c
sapi/embed/php_embed.c

diff --git a/NEWS b/NEWS
index 96d6dade5c44d2da859ca1a5d62ff1ed36abf95b..f579a7be07d9e4a84e55ad07345ca3a0d1c5d30d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ PHP                                                                        NEWS
 - Deprecated session_register(), session_unregister() and
   session_is_registered(). (Hannes)
 
+- Changed dl() to be disabled by default. Enabled only when explicitly
+  registered by the SAPI layer. Enabled only with CLI, CGI and EMBED. (Dmitry)
 - Changed opendir(), dir() and scandir() to use default context when no context
   argument is passed. (Sara)
 - Changed open_basedir to allow tightening in runtime contexts. (Sara)
index 7d87b9a7dbd1986c2fb3178f2307a32e1f35a372..c986e8034c5a9e9526e0baba32e5d492361f3e0d 100644 (file)
@@ -3025,9 +3025,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */
        PHP_FE(is_scalar,                                                                                                               arginfo_is_scalar)
        PHP_FE(is_callable,                                                                                                             arginfo_is_callable)
 
-       /* functions from dl.c */
-       PHP_FE(dl,                                                                                                                              arginfo_dl)
-
        /* functions from file.c */
        PHP_FE(pclose,                                                                                                                  arginfo_pclose)
        PHP_FE(popen,                                                                                                                   arginfo_popen)
index 4431071d547775862bde3fdebbd982494e9ae1c6..5907688b434c7eb051e8b1ba9afd91738b312076 100644 (file)
@@ -264,6 +264,7 @@ struct _sapi_module_struct {
        int phpinfo_as_text;
 
        char *ini_entries;
+       const zend_function_entry *additional_functions;
 };
 
 
index f33fb83ffc2c22ff8afab149d6baf9501b7358da..7ab84d2c2cea7a41ac78eb6419f8c473d73a5d85 100644 (file)
@@ -1910,6 +1910,15 @@ 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) {
+               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;
+               }
+       }
+       
        /* make core report what it should */
        if (zend_hash_find(&module_registry, "core", sizeof("core"), (void**)&module)==SUCCESS) {
                module->version = PHP_VERSION;
index f0cec7ca8ace9c769fc2f8def51199d3505a6daa..4d40499f2b7b210b84ce77e0a036b06ce2b62a4d 100644 (file)
@@ -850,6 +850,17 @@ static sapi_module_struct cgi_sapi_module = {
 };
 /* }}} */
 
+/* {{{ arginfo ext/standard/dl.c */
+ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
+       ZEND_ARG_INFO(0, extension_filename)
+ZEND_END_ARG_INFO()
+/* }}} */
+
+static const zend_function_entry additional_functions[] = {
+       ZEND_FE(dl, arginfo_dl)
+       {NULL, NULL, NULL}
+};
+
 /* {{{ php_cgi_usage
  */
 static void php_cgi_usage(char *argv0)
@@ -1534,6 +1545,7 @@ 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 (cgi_sapi_module.startup(&cgi_sapi_module) == FAILURE) {
index 2b458a503c3c9838242493c0be30869d75e9c30b..519217fa24d8e3b78bb8fd562fc45451aeb6012e 100644 (file)
@@ -426,6 +426,17 @@ static sapi_module_struct cli_sapi_module = {
 };
 /* }}} */
 
+/* {{{ arginfo ext/standard/dl.c */
+ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
+       ZEND_ARG_INFO(0, extension_filename)
+ZEND_END_ARG_INFO()
+/* }}} */
+
+static const zend_function_entry additional_functions[] = {
+       ZEND_FE(dl, arginfo_dl)
+       {NULL, NULL, NULL}
+};
+
 /* {{{ php_cli_usage
  */
 static void php_cli_usage(char *argv0)
@@ -704,6 +715,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;
 
        /* startup after we get the above ini override se we get things right */
        if (cli_sapi_module.startup(&cli_sapi_module)==FAILURE) {
index 99e8882fec4fe9d090c372ec19117e6bf1a10d19..3d9394717339b771f2d3109c93840bdaf7885b4e 100644 (file)
@@ -140,6 +140,17 @@ sapi_module_struct php_embed_module = {
 };
 /* }}} */
 
+/* {{{ arginfo ext/standard/dl.c */
+ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
+       ZEND_ARG_INFO(0, extension_filename)
+ZEND_END_ARG_INFO()
+/* }}} */
+
+static const zend_function_entry additional_functions[] = {
+       ZEND_FE(dl, arginfo_dl)
+       {NULL, NULL, NULL}
+};
+
 int php_embed_init(int argc, char **argv PTSRMLS_DC)
 {
        zend_llist global_vars;
@@ -176,6 +187,8 @@ int php_embed_init(int argc, char **argv PTSRMLS_DC)
   php_embed_module.ini_entries = malloc(sizeof(HARDCODED_INI));
   memcpy(php_embed_module.ini_entries, HARDCODED_INI, sizeof(HARDCODED_INI));
 
+  php_embed_module.additional_functions = additional_functions;
+
   if (argv) {
        php_embed_module.executable_location = argv[0];
   }