]> granicus.if.org Git - php/commitdiff
Removed register_long_arrays ini option (and $HTTP_SESSION_VARS from ext/session)
authorKalle Sommer Nielsen <kalle@php.net>
Thu, 15 Apr 2010 16:36:08 +0000 (16:36 +0000)
committerKalle Sommer Nielsen <kalle@php.net>
Thu, 15 Apr 2010 16:36:08 +0000 (16:36 +0000)
12 files changed:
NEWS
Zend/tests/unset_cv05.phpt
ext/filter/filter.c
ext/session/session.c
ext/session/tests/007.phpt
ext/session/tests/008-php4.2.3.phpt
ext/session/tests/009.phpt
main/main.c
main/php_globals.h
main/php_variables.c
php.ini-development
php.ini-production

diff --git a/NEWS b/NEWS
index c1a1c7a8795ad2e396ef970f0c671f0519f38467..813e7fa0457d01c36db8074fc8378e6257c5f079 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@
 
 - Removed legacy features: (Kalle)
   . define_syslog_variables ini option and its associated function.
+  . register_long_arrays ini option.
   . y2k_compliance ini option.
        
 ?? ??? 20??, PHP 5.3.3
index 8e3c6349b7ca4259f28b9c1471ca68ad77b5e623..6ef7b34ce06f43fbf77ac9d958b0ae78465f165f 100644 (file)
@@ -1,7 +1,6 @@
 --TEST--
 unset() CV 5 (indirect unset() of global variable in session_start())
 --INI--
-register_long_arrays=1
 session.auto_start=0
 session.save_handler=files
 --SKIPIF--
@@ -12,14 +11,13 @@ include(dirname(__FILE__).'/../../ext/session/tests/skipif.inc');
 ?>
 --FILE--
 <?php
-$HTTP_SESSION_VARS = "ok\n";
-echo $HTTP_SESSION_VARS;
+$_SESSION = "ok\n";
+echo $_SESSION;
 session_start();
-echo $HTTP_SESSION_VARS;
+echo $_SESSION;
 echo "\nok\n";
 ?>
 --EXPECTF--
-Warning: Directive 'register_long_arrays' is deprecated in PHP %d.%d and greater in Unknown on line 0
 ok
 
 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at %sunset_cv05.php on line %d
index 2ffe70499bcf738805991d301f7c6bbcafd97896..a2387f6a77a704ff319930818f54f410d1c72644 100644 (file)
@@ -537,7 +537,7 @@ static zval *php_filter_get_storage(long arg TSRMLS_DC)/* {{{ */
 
 {
        zval *array_ptr = NULL;
-       zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals) && !PG(register_long_arrays));
+       zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals));
 
        switch (arg) {
                case PARSE_GET:
index 3455421a7e502f03bb422ade0de89fe7d3cb2e7a..73fc53d74177c943a8296c11b0796a5d4b8daee0 100644 (file)
@@ -235,8 +235,7 @@ static void php_session_track_init(TSRMLS_D) /* {{{ */
 {
        zval *session_vars = NULL;
 
-       /* Unconditionally destroy existing arrays -- possible dirty data */
-       zend_delete_global_variable("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS")-1 TSRMLS_CC);
+       /* Unconditionally destroy existing array -- possible dirty data */
        zend_delete_global_variable("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC);
 
        if (PS(http_session_vars)) {
@@ -247,13 +246,7 @@ static void php_session_track_init(TSRMLS_D) /* {{{ */
        array_init(session_vars);
        PS(http_session_vars) = session_vars;
 
-       if (PG(register_long_arrays)) {
-               ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 3, 1);
-               ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 3, 1);
-       }
-       else {
-               ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
-       }
+       ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
 }
 /* }}} */
 
@@ -1814,9 +1807,7 @@ static void php_register_var(zval** entry TSRMLS_DC)
        } else {
                convert_to_string_ex(entry);
 
-               if ((strcmp(Z_STRVAL_PP(entry), "HTTP_SESSION_VARS") != 0) &&
-                       (strcmp(Z_STRVAL_PP(entry), "_SESSION") != 0)
-               ) {
+               if (strcmp(Z_STRVAL_PP(entry), "_SESSION") != 0) {
                        PS_ADD_VARL(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry));
                }
        }
index 9531b3dd8a5bbad1d67f48c30742c605c9118afc..61fd0974e3b629ebb03dad27f08382409039b6f8 100644 (file)
@@ -3,7 +3,6 @@ bug compatibility: unset($c) with enabled register_globals
 --SKIPIF--
 <?php include('skipif.inc'); ?>
 --INI--
-register_long_arrays=1
 session.use_cookies=0
 session.cache_limiter=
 register_globals=1
@@ -21,39 +20,37 @@ session_id("abtest");
 session_start();
 session_destroy();
 
-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
+### Phase 2 $_SESSION["c"] does not contain any value
 session_id("abtest");
 session_register("c");
 unset($c);
 $c = 3.14;
 session_write_close();
-unset($HTTP_SESSION_VARS);
+unset($_SESSION);
 unset($c);
 
-### Phase 3 $HTTP_SESSION_VARS["c"] is set
+### Phase 3 $_SESSION["c"] is set
 session_start();
 var_dump($c);
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 unset($c);
 $c = 2.78;
 
 session_write_close();
-unset($HTTP_SESSION_VARS);
+unset($_SESSION);
 unset($c);
 
 ### Phase 4 final
 
 session_start();
 var_dump($c);
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 
 session_destroy();
 ?>
 --EXPECTF--
 Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
 
-Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
-
 Deprecated: Function session_register() is deprecated in %s on line %d
 float(3.14)
 array(1) {
index 4fe938fbcd7bb9cfde533f606f5622e7b3175943..2b712e9bdc049d7046c75a7f7820ffd36dc2ceab 100644 (file)
@@ -5,7 +5,6 @@ bug compatibility: global is used albeit register_globals=0
  if (version_compare(PHP_VERSION,"4.2.3-dev", "<")) die("skip this is for PHP >= 4.2.3");
 ?>
 --INI--
-register_long_arrays=1
 session.use_cookies=0
 session.cache_limiter=
 register_globals=0
@@ -27,7 +26,7 @@ session_id("abtest");
 session_start();
 session_destroy();
 
-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
+### Phase 2 $_SESSION["c"] does not contain any value
 session_id("abtest");
 session_register("c");
 var_dump($c);
@@ -36,29 +35,28 @@ $c = 3.14;
 @session_write_close(); // this generates an E_WARNING which will be printed 
 // by $php_errormsg so we can use "@" here. ANY further message IS an error.
 echo $php_errormsg."\n";
-unset($HTTP_SESSION_VARS);
+unset($_SESSION);
 unset($c);
 
-### Phase 3 $HTTP_SESSION_VARS["c"] is set
+### Phase 3 $_SESSION["c"] is set
 session_start();
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 unset($c);
 $c = 2.78;
 
 session_write_close();
-unset($HTTP_SESSION_VARS);
+unset($_SESSION);
 unset($c);
 
 ### Phase 4 final
 
 session_start();
 var_dump($c);
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 
 session_destroy();
 ?>
 --EXPECTF--
-Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
 NULL
 session_write_close(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively
 array(1) {
index 705a2758f62638851af89e26f7eb51259538d040..17aab94a8f5e11a35c0effa6948f1e25ad56be7e 100644 (file)
@@ -3,7 +3,6 @@ unset($_SESSION["name"]); should work with register_globals=off
 --SKIPIF--
 <?php include('skipif.inc'); ?>
 --INI--
-register_long_arrays=1
 session.use_cookies=0
 session.cache_limiter=
 register_globals=0
@@ -21,29 +20,28 @@ session_id("abtest");
 session_start();
 session_destroy();
 
-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
+### Phase 2 $_SESSION["c"] does not contain any value
 session_id("abtest");
 session_start();
-var_dump($HTTP_SESSION_VARS);
-$HTTP_SESSION_VARS["name"] = "foo";
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
+$_SESSION["name"] = "foo";
+var_dump($_SESSION);
 session_write_close();
 
-### Phase 3 $HTTP_SESSION_VARS["c"] is set
+### Phase 3 $_SESSION["c"] is set
 session_start();
-var_dump($HTTP_SESSION_VARS);
-unset($HTTP_SESSION_VARS["name"]);
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
+unset($_SESSION["name"]);
+var_dump($_SESSION);
 session_write_close();
 
 ### Phase 4 final
 
 session_start();
-var_dump($HTTP_SESSION_VARS);
+var_dump($_SESSION);
 session_destroy();
 ?>
 --EXPECT--
-Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
 array(0) {
 }
 array(1) {
index b781b2975ac80075d2ff5270e5b5d938fb5fa2f0..16e4f9d5388c89ebb33871db4126482b4433fbdd 100644 (file)
@@ -459,7 +459,6 @@ PHP_INI_BEGIN()
        STD_PHP_INI_ENTRY("output_handler",                     NULL,           PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateString, output_handler,         php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("register_argc_argv",       "1",            PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   register_argc_argv,             php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("register_globals",         "0",            PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   register_globals,               php_core_globals,       core_globals)
-       STD_PHP_INI_BOOLEAN("register_long_arrays",     "1",            PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   register_long_arrays,   php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("auto_globals_jit",         "1",            PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   auto_globals_jit,       php_core_globals,       core_globals)
 #if PHP_SAFE_MODE
        STD_PHP_INI_BOOLEAN("safe_mode",                        "1",            PHP_INI_SYSTEM,         OnUpdateBool,                   safe_mode,                              php_core_globals,       core_globals)
@@ -2056,14 +2055,13 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
                struct {
                        const long error_level;
                        const char *phrase;
-                       const char *directives[7]; /* Remember to change this if the number of directives change */
+                       const char *directives[6]; /* Remember to change this if the number of directives change */
                } directives[] = {
                        {
                                E_CORE_WARNING, 
                                "Directive '%s' is deprecated in PHP 5.3 and greater", 
                                {
                                        "register_globals", 
-                                       "register_long_arrays", 
                                        "safe_mode", 
                                        "magic_quotes_gpc", 
                                        "magic_quotes_runtime", 
@@ -2076,6 +2074,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
                                "Directive '%s' is no longer available in PHP", 
                                {
                                        "define_syslog_variables", 
+                                       "register_long_arrays", 
                                        "zend.ze1_compatibility_mode", 
                                        NULL
                                }
index f12073abc325276de686b4f8e3a3a3cf2213e982..14a09f2fd01682eb9e0af62b13e619ff877d44b0 100644 (file)
@@ -123,7 +123,6 @@ struct _php_core_globals {
        zend_bool expose_php;
 
        zend_bool register_globals;
-       zend_bool register_long_arrays;
        zend_bool register_argc_argv;
        zend_bool auto_globals_jit;
 
index e972febfb9fc695e5880776b412a9b263cbfcc3b..7d58fd1c325b2a0bb0144d2759964c8b976af682 100644 (file)
@@ -653,20 +653,18 @@ int php_hash_environment(TSRMLS_D)
 {
        char *p;
        unsigned char _gpc_flags[5] = {0, 0, 0, 0, 0};
-       zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals) && !PG(register_long_arrays));
+       zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals));
        struct auto_global_record {
                char *name;
                uint name_len;
-               char *long_name;
-               uint long_name_len;
                zend_bool jit_initialization;
        } auto_global_records[] = {
-               { "_POST", sizeof("_POST"), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), 0 },
-               { "_GET", sizeof("_GET"), "HTTP_GET_VARS", sizeof("HTTP_GET_VARS"), 0 },
-               { "_COOKIE", sizeof("_COOKIE"), "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS"), 0 },
-               { "_SERVER", sizeof("_SERVER"), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), 1 },
-               { "_ENV", sizeof("_ENV"), "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS"), 1 },
-               { "_FILES", sizeof("_FILES"), "HTTP_POST_FILES", sizeof("HTTP_POST_FILES"), 0 },
+               { "_POST", sizeof("_POST"), 0 },
+               { "_GET", sizeof("_GET"), 0 },
+               { "_COOKIE", sizeof("_COOKIE"), 0 },
+               { "_SERVER", sizeof("_SERVER"), 1 },
+               { "_ENV", sizeof("_ENV"), 1 },
+               { "_FILES", sizeof("_FILES"), 0 },
        };
        size_t num_track_vars = sizeof(auto_global_records)/sizeof(struct auto_global_record);
        size_t i;
@@ -750,10 +748,6 @@ int php_hash_environment(TSRMLS_D)
 
                Z_ADDREF_P(PG(http_globals)[i]);
                zend_hash_update(&EG(symbol_table), auto_global_records[i].name, auto_global_records[i].name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
-               if (PG(register_long_arrays)) {
-                       zend_hash_update(&EG(symbol_table), auto_global_records[i].long_name, auto_global_records[i].long_name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
-                       Z_ADDREF_P(PG(http_globals)[i]);
-               }
        }
 
        /* Create _REQUEST */
@@ -800,11 +794,6 @@ static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS
 
        zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
        Z_ADDREF_P(PG(http_globals)[TRACK_VARS_SERVER]);
-
-       if (PG(register_long_arrays)) {
-               zend_hash_update(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
-               Z_ADDREF_P(PG(http_globals)[TRACK_VARS_SERVER]);
-       }
        
        return 0; /* don't rearm */
 }
@@ -827,11 +816,6 @@ static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC
        zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
        Z_ADDREF_P(PG(http_globals)[TRACK_VARS_ENV]);
 
-       if (PG(register_long_arrays)) {
-               zend_hash_update(&EG(symbol_table), "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS"), &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
-               Z_ADDREF_P(PG(http_globals)[TRACK_VARS_ENV]);
-       }
-
        return 0; /* don't rearm */
 }
 
index 8f73bfb24f2a39e81bcca5f527fe940753acfbad..c7a78160beba69f87ad6722123ebcf71ac1f6b36 100644 (file)
 ;   Development Value: Off
 ;   Production Value: Off
 
-; register_long_arrays
-;   Default Value: On
-;   Development Value: Off
-;   Production Value: Off
-
 ; request_order
 ;   Default Value: None
 ;   Development Value: "GP"
@@ -686,16 +681,6 @@ request_order = "GP"
 ; http://php.net/register-globals
 register_globals = Off
 
-; Determines whether the deprecated long $HTTP_*_VARS type predefined variables
-; are registered by PHP or not. As they are deprecated, we obviously don't
-; recommend you use them. They are on by default for compatibility reasons but
-; they are not recommended on production servers.
-; Default Value: On
-; Development Value: Off
-; Production Value: Off
-; http://php.net/register-long-arrays
-register_long_arrays = Off
-
 ; This directive determines whether PHP registers $argv & $argc each time it
 ; runs. $argv contains an array of all the arguments passed to PHP when a script
 ; is invoked. $argc contains an integer representing the number of arguments
@@ -714,8 +699,8 @@ register_argc_argv = Off
 ; When enabled, the SERVER and ENV variables are created when they're first
 ; used (Just In Time) instead of when the script starts. If these variables
 ; are not used within a script, having this directive on will result in a
-; performance gain. The PHP directives register_globals, register_long_arrays,
-; and register_argc_argv must be disabled for this directive to have any affect.
+; performance gain. The PHP directives register_globals and register_argc_argv 
+; must be disabled for this directive to have any affect.
 ; http://php.net/auto-globals-jit
 auto_globals_jit = On
 
index f0b7e82bba21132efaf5148ff3bd4ed39d7d0a01..3dc1e049880d7f01d2a306798c1e33a77d5ce635 100644 (file)
 ;   Development Value: Off
 ;   Production Value: Off
 
-; register_long_arrays
-;   Default Value: On
-;   Development Value: Off
-;   Production Value: Off
-
 ; request_order
 ;   Default Value: None
 ;   Development Value: "GP"
@@ -686,16 +681,6 @@ request_order = "GP"
 ; http://php.net/register-globals
 register_globals = Off
 
-; Determines whether the deprecated long $HTTP_*_VARS type predefined variables
-; are registered by PHP or not. As they are deprecated, we obviously don't
-; recommend you use them. They are on by default for compatibility reasons but
-; they are not recommended on production servers.
-; Default Value: On
-; Development Value: Off
-; Production Value: Off
-; http://php.net/register-long-arrays
-register_long_arrays = Off
-
 ; This directive determines whether PHP registers $argv & $argc each time it
 ; runs. $argv contains an array of all the arguments passed to PHP when a script
 ; is invoked. $argc contains an integer representing the number of arguments
@@ -714,8 +699,8 @@ register_argc_argv = Off
 ; When enabled, the SERVER and ENV variables are created when they're first
 ; used (Just In Time) instead of when the script starts. If these variables
 ; are not used within a script, having this directive on will result in a
-; performance gain. The PHP directives register_globals, register_long_arrays,
-; and register_argc_argv must be disabled for this directive to have any affect.
+; performance gain. The PHP directives register_globals and register_argc_argv 
+; must be disabled for this directive to have any affect.
 ; http://php.net/auto-globals-jit
 auto_globals_jit = On