Hi Marcus,

I think dl() should also be disabled for FastCGI.
It may require a bit of reordering of the code to make this work but I
think it's the right thing.

If you bump into any problems then maybe Dmitry could help out but he's
on vacation for the next couple of weeks.

Thanks!
Andi

-----Original Message-----
From: Marcus Boerger [mailto:he...@php.net] 
Sent: Wednesday, December 31, 2008 6:27 AM
To: php-cvs@lists.php.net; php...@lists.php.net
Subject: [PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard
basic_functions.c /main SAPI.h main.c /sapi/cgi cgi_main.c /sapi/cli
php_cli.c /sapi/embed php_embed.c 

helly           Wed Dec 31 14:27:10 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src    NEWS 
    /php-src/ext/standard       basic_functions.c 
    /php-src/main       SAPI.h main.c 
    /php-src/sapi/cgi   cgi_main.c 
    /php-src/sapi/cli   php_cli.c 
    /php-src/sapi/embed php_embed.c 
  Log:
  MFH
  - 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]
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.428&r
2=1.2027.2.547.2.965.2.429&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.428
php-src/NEWS:1.2027.2.547.2.965.2.429
--- php-src/NEWS:1.2027.2.547.2.965.2.428       Tue Dec 30 23:34:29 2008
+++ php-src/NEWS        Wed Dec 31 14:27:08 2008
@@ -6,6 +6,8 @@
 - 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)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=
1.725.2.31.2.64.2.79&r2=1.725.2.31.2.64.2.80&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.79
php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.80
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.79 Wed Dec
31 11:15:44 2008
+++ php-src/ext/standard/basic_functions.c      Wed Dec 31 14:27:09 2008
@@ -18,7 +18,7 @@
 
+----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.79 2008/12/31 11:15:44
sebastian Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.80 2008/12/31 14:27:09
helly Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -3025,9 +3025,6 @@
        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)
http://cvs.php.net/viewvc.cgi/php-src/main/SAPI.h?r1=1.114.2.1.2.3.2.5&r
2=1.114.2.1.2.3.2.6&diff_format=u
Index: php-src/main/SAPI.h
diff -u php-src/main/SAPI.h:1.114.2.1.2.3.2.5
php-src/main/SAPI.h:1.114.2.1.2.3.2.6
--- php-src/main/SAPI.h:1.114.2.1.2.3.2.5       Wed Dec 31 11:15:47 2008
+++ php-src/main/SAPI.h Wed Dec 31 14:27:09 2008
@@ -16,7 +16,7 @@
 
+----------------------------------------------------------------------+
 */
 
-/* $Id: SAPI.h,v 1.114.2.1.2.3.2.5 2008/12/31 11:15:47 sebastian Exp $
*/
+/* $Id: SAPI.h,v 1.114.2.1.2.3.2.6 2008/12/31 14:27:09 helly Exp $ */
 
 #ifndef SAPI_H
 #define SAPI_H
@@ -264,6 +264,7 @@
        int phpinfo_as_text;
 
        char *ini_entries;
+       const zend_function_entry *additional_functions;
 };
 
 
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.57.2.4
0&r2=1.640.2.23.2.57.2.41&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.57.2.40
php-src/main/main.c:1.640.2.23.2.57.2.41
--- php-src/main/main.c:1.640.2.23.2.57.2.40    Wed Dec 31 14:05:22 2008
+++ php-src/main/main.c Wed Dec 31 14:27:09 2008
@@ -18,7 +18,7 @@
 
+----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.640.2.23.2.57.2.40 2008/12/31 14:05:22 helly Exp $
*/
+/* $Id: main.c,v 1.640.2.23.2.57.2.41 2008/12/31 14:27:09 helly Exp $
*/
 
 /* {{{ includes
  */
@@ -1910,6 +1910,15 @@
        /* 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;
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.
2.50.2.33&r2=1.267.2.15.2.50.2.34&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.33
php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.34
--- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.33    Wed Dec 31
11:15:48 2008
+++ php-src/sapi/cgi/cgi_main.c Wed Dec 31 14:27:09 2008
@@ -21,7 +21,7 @@
 
+----------------------------------------------------------------------+
 */
 
-/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.33 2008/12/31 11:15:48 sebastian
Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.34 2008/12/31 14:27:09 helly Exp
$ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -850,6 +850,17 @@
 };
 /* }}} */
 
+/* {{{ 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 @@
 #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) {
http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.129.2.13.2
.22.2.18&r2=1.129.2.13.2.22.2.19&diff_format=u
Index: php-src/sapi/cli/php_cli.c
diff -u php-src/sapi/cli/php_cli.c:1.129.2.13.2.22.2.18
php-src/sapi/cli/php_cli.c:1.129.2.13.2.22.2.19
--- php-src/sapi/cli/php_cli.c:1.129.2.13.2.22.2.18     Wed Dec 31
11:15:49 2008
+++ php-src/sapi/cli/php_cli.c  Wed Dec 31 14:27:09 2008
@@ -20,7 +20,7 @@
 
+----------------------------------------------------------------------+
 */
 
-/* $Id: php_cli.c,v 1.129.2.13.2.22.2.18 2008/12/31 11:15:49 sebastian
Exp $ */
+/* $Id: php_cli.c,v 1.129.2.13.2.22.2.19 2008/12/31 14:27:09 helly Exp
$ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -426,6 +426,17 @@
 };
 /* }}} */
 
+/* {{{ 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 @@
        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) {
http://cvs.php.net/viewvc.cgi/php-src/sapi/embed/php_embed.c?r1=1.11.2.1
.2.5.2.4&r2=1.11.2.1.2.5.2.5&diff_format=u
Index: php-src/sapi/embed/php_embed.c
diff -u php-src/sapi/embed/php_embed.c:1.11.2.1.2.5.2.4
php-src/sapi/embed/php_embed.c:1.11.2.1.2.5.2.5
--- php-src/sapi/embed/php_embed.c:1.11.2.1.2.5.2.4     Wed Dec 31
11:15:49 2008
+++ php-src/sapi/embed/php_embed.c      Wed Dec 31 14:27:09 2008
@@ -15,7 +15,7 @@
    | Author: Edin Kadribasic <ed...@php.net>
|
 
+----------------------------------------------------------------------+
 */
-/* $Id: php_embed.c,v 1.11.2.1.2.5.2.4 2008/12/31 11:15:49 sebastian
Exp $ */
+/* $Id: php_embed.c,v 1.11.2.1.2.5.2.5 2008/12/31 14:27:09 helly Exp $
*/
 
 #include "php_embed.h"
 
@@ -140,6 +140,17 @@
 };
 /* }}} */
 
+/* {{{ 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 @@
   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];
   }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to