]> granicus.if.org Git - php/commitdiff
Removed import_request_variables(), this is not needed anymore without register_globals
authorKalle Sommer Nielsen <kalle@php.net>
Wed, 21 Apr 2010 22:23:55 +0000 (22:23 +0000)
committerKalle Sommer Nielsen <kalle@php.net>
Wed, 21 Apr 2010 22:23:55 +0000 (22:23 +0000)
NEWS
Zend/tests/unset_cv07.phpt
ext/standard/basic_functions.c
ext/standard/basic_functions.h
ext/standard/tests/general_functions/import_request.phpt
ext/standard/tests/general_functions/import_request1.phpt
ext/standard/tests/general_functions/import_request2.phpt
ext/standard/tests/general_functions/import_request3.phpt

diff --git a/NEWS b/NEWS
index d3ac69a20e917f72ed311589790fe8c14bc0ab02..ff76aa148f16504251fc0447c2d52d8b718dc79d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@
 - Removed legacy features: (Kalle)
   . define_syslog_variables ini option and its associated function.
   . highlight.bg ini option.
+  . import_request_variables().
   . register_globals.
   . register_long_arrays ini option.
   . y2k_compliance ini option.
index b7bdb7db5c9a6e2a2e9d143603b7f39c39d1d586..afa78189f7df38d0eb2effcd2c8be8422051d764 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 unset() CV 7 (indirect unset() of global variable in import_request_variables())
+--SKIPIF--
+<?php if(PHP_VERSION_ID < 503099){ die('Not needed anymore without register_globals'); } ?>
 --GET--
 x=2
 --FILE--
index 612afa3a4149f861e7faae206dd5e3d8f54d0c99..4555814e173f288ef1e3b2da87513bb295d7fb05 100644 (file)
@@ -855,11 +855,6 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0)
 ZEND_END_ARG_INFO()
 #endif
-ZEND_BEGIN_ARG_INFO_EX(arginfo_import_request_variables, 0, 0, 1)
-       ZEND_ARG_INFO(0, types)
-       ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO()
 
 #ifdef HAVE_GETLOADAVG
 ZEND_BEGIN_ARG_INFO(arginfo_sys_getloadavg, 0)
@@ -2946,7 +2941,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */
        PHP_FE(get_magic_quotes_gpc,                                                                                    arginfo_get_magic_quotes_gpc)
        PHP_FE(get_magic_quotes_runtime,                                                                                arginfo_get_magic_quotes_runtime)
 
-       PHP_FE(import_request_variables,                                                                                arginfo_import_request_variables)
        PHP_FE(error_log,                                                                                                               arginfo_error_log)
        PHP_FE(error_get_last,                                                                                                  arginfo_error_get_last)
        PHP_FE(call_user_func,                                                                                                  arginfo_call_user_func)
@@ -6026,104 +6020,6 @@ PHP_FUNCTION(config_get_hash) /* {{{ */
 /* }}} */
 #endif
 
-static int copy_request_variable(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
-{
-       zval *prefix, new_key;
-       int prefix_len;
-       zval **var = (zval **) pDest;
-
-       if (num_args != 1) {
-               return 0;
-       }
-
-       prefix = va_arg(args, zval *);
-       prefix_len = Z_STRLEN_P(prefix);
-
-       if (!prefix_len && !hash_key->nKeyLength) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric key detected - possible security hazard");
-               return 0;
-       }
-
-       if (hash_key->nKeyLength) {
-               php_prefix_varname(&new_key, prefix, hash_key->arKey, hash_key->nKeyLength - 1, 0 TSRMLS_CC);
-       } else {
-               zval num;
-
-               ZVAL_LONG(&num, hash_key->h);
-               convert_to_string(&num);
-               php_prefix_varname(&new_key, prefix, Z_STRVAL(num), Z_STRLEN(num), 0 TSRMLS_CC);
-               zval_dtor(&num);
-       }
-
-       if (php_varname_check(Z_STRVAL(new_key), Z_STRLEN(new_key), 0 TSRMLS_CC) == FAILURE) {
-               zval_dtor(&new_key);
-               return 0;
-       }
-
-       zend_delete_global_variable(Z_STRVAL(new_key), Z_STRLEN(new_key) TSRMLS_CC);
-       ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), Z_STRVAL(new_key), Z_STRLEN(new_key) + 1, *var, Z_REFCOUNT_PP(var) + 1, 0);
-
-       zval_dtor(&new_key);
-       return 0;
-}
-/* }}} */
-
-/* {{{ proto bool import_request_variables(string types [, string prefix])
-   Import GET/POST/Cookie variables into the global scope */
-PHP_FUNCTION(import_request_variables)
-{
-       char *types;
-       int types_len;
-       zval *prefix = NULL;
-       char *p;
-       zend_bool ok = 0;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/", &types, &types_len, &prefix) == FAILURE) {
-               return;
-       }
-
-       if (ZEND_NUM_ARGS() > 1) {
-               convert_to_string(prefix);
-
-               if (Z_STRLEN_P(prefix) == 0) {
-                       php_error_docref(NULL TSRMLS_CC, E_NOTICE, "No prefix specified - possible security hazard");
-               }
-       } else {
-               MAKE_STD_ZVAL(prefix);
-               ZVAL_EMPTY_STRING(prefix);
-       }
-
-       for (p = types; p && *p; p++) {
-               switch (*p) {
-
-                       case 'g':
-                       case 'G':
-                               zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]) TSRMLS_CC, (apply_func_args_t) copy_request_variable, 1, prefix);
-                               ok = 1;
-                               break;
-
-                       case 'p':
-                       case 'P':
-                               zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]) TSRMLS_CC, (apply_func_args_t) copy_request_variable, 1, prefix);
-                               zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_FILES]) TSRMLS_CC, (apply_func_args_t) copy_request_variable, 1, prefix);
-                               ok = 1;
-                               break;
-
-                       case 'c':
-                       case 'C':
-                               zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC, (apply_func_args_t) copy_request_variable, 1, prefix);
-                               ok = 1;
-                               break;
-               }
-       }
-
-       if (ZEND_NUM_ARGS() < 2) {
-               zval_ptr_dtor(&prefix);
-       }
-       RETURN_BOOL(ok);
-}
-/* }}} */
-
 #ifdef HAVE_GETLOADAVG
 /* {{{ proto array sys_getloadavg()
 */
index a715d731127abeecefa6f93d9a0055fcbc801cba..e2190066f087b9450eb09df4e084870a4e75aba4 100644 (file)
@@ -74,8 +74,6 @@ PHP_FUNCTION(set_magic_quotes_runtime);
 PHP_FUNCTION(get_magic_quotes_runtime);
 PHP_FUNCTION(get_magic_quotes_gpc);
 
-PHP_FUNCTION(import_request_variables);
-
 PHP_FUNCTION(error_log);
 PHP_FUNCTION(error_get_last);
 
index 0067632391675232146837293293b76eff61711e..9d4ee8037286bff514eea7efb7474bd9d023cd26 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 import_request_variables() tests
+--SKIPIF--
+<?php if(PHP_VERSION_ID < 503099){ die('Not needed anymore without register_globals'); } ?>
 --GET--
 a=1&b=heh&c=3&d[]=5&GLOBALS=test&1=hm
 --POST--
index cb6df69e089b989dfcf5701c8b615e64b4949700..49259efaaaeb3ed99c594ea6b4c5d473daf95042 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 import_request_variables() test (overwrite super-globals)
+--SKIPIF--
+<?php if(PHP_VERSION_ID < 503099){ die('Not needed anymore without register_globals'); } ?>
 --GET--
 GET=0&POST=1&COOKIE=2&FILES=3&REQUEST=4
 --POST--
index eb278217c0cfdb923afcba5817651788134fc1c9..b3522ddd12d83683cf4eb7d47b5dcae120bf72c5 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 import_request_variables() test (numeric keys)
+--SKIPIF--
+<?php if(PHP_VERSION_ID < 503099){ die('Not needed anymore without register_globals'); } ?>
 --GET--
 1=0&2=1&3=2&4=3&5=4
 --POST--
index a9fba26ddf61003e9861366cb760051fa7a93593..bfa21b3020c723fbe9e635a45b54d5a79fde6a5f 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 import_request_variables() test (numeric keys, different order)
+--SKIPIF--
+<?php if(PHP_VERSION_ID < 503099){ die('Not needed anymore without register_globals'); } ?>
 --GET--
 1=0&2=1&3=2&4=3&5=4
 --POST--