iliaa Thu Jul 31 19:00:21 2003 EDT Modified files: (Branch: PHP_4_3) /php-src/main main.c /php-src NEWS Log: MFH: Fixed bug #24883 (variables created through register_globals, ignore gpc_order and variables_order). Index: php-src/main/main.c diff -u php-src/main/main.c:1.512.2.43 php-src/main/main.c:1.512.2.44 --- php-src/main/main.c:1.512.2.43 Tue Jul 22 11:46:48 2003 +++ php-src/main/main.c Thu Jul 31 19:00:21 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.512.2.43 2003/07/22 15:46:48 zeev Exp $ */ +/* $Id: main.c,v 1.512.2.44 2003/07/31 23:00:21 iliaa Exp $ */ /* {{{ includes */ @@ -1313,6 +1313,11 @@ sapi_module.register_server_variables(array_ptr TSRMLS_CC); } + /* argv/argc support */ + if (PG(register_argc_argv)) { + php_build_argv(SG(request_info).query_string TSRMLS_CC); + } + /* PHP Authentication support */ if (SG(request_info).auth_user) { php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, array_ptr TSRMLS_CC); @@ -1400,6 +1405,9 @@ array_init(PG(http_globals)[TRACK_VARS_ENV]); INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]); php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC); + if (PG(register_globals)) { + php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV]) TSRMLS_CC); + } } for (p=variables_order; p && *p; p++) { @@ -1408,21 +1416,30 @@ case 'P': if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method && !strcmp(SG(request_info).request_method, "POST")) { sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC); /* POST Data */ - _gpc_flags[0]=TRACK_VARS_POST + 1; + _gpc_flags[0]=1; + if (PG(register_globals)) { + php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]) TSRMLS_CC); + } } break; case 'c': case 'C': if (!_gpc_flags[1]) { sapi_module.treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC); /* Cookie Data */ - _gpc_flags[1]=TRACK_VARS_COOKIE + 1; + _gpc_flags[1]=1; + if (PG(register_globals)) { + php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC); + } } break; case 'g': case 'G': if (!_gpc_flags[2]) { sapi_module.treat_data(PARSE_GET, NULL, NULL TSRMLS_CC); /* GET Data */ - _gpc_flags[2]=TRACK_VARS_GET + 1; + _gpc_flags[2]=1; + if (PG(register_globals)) { + php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]) TSRMLS_CC); + } } break; case 'e': @@ -1433,17 +1450,23 @@ array_init(PG(http_globals)[TRACK_VARS_ENV]); INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]); php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC); + if (PG(register_globals)) { + php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV]) TSRMLS_CC); + } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported 'e' element (environment) used in gpc_order - use variables_order instead"); } - _gpc_flags[3]=TRACK_VARS_ENV + 1; + _gpc_flags[3]=1; } break; case 's': case 'S': if (!_gpc_flags[4]) { php_register_server_variables(TSRMLS_C); - _gpc_flags[4]=TRACK_VARS_SERVER + 1; + _gpc_flags[4]=1; + if (PG(register_globals)) { + php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]) TSRMLS_CC); + } } break; } @@ -1451,18 +1474,8 @@ if (!have_variables_order && !PG(http_globals)[TRACK_VARS_SERVER]) { php_register_server_variables(TSRMLS_C); - } - - /* argv/argc support */ - if (PG(register_argc_argv)) { - php_build_argv(SG(request_info).query_string TSRMLS_CC); - } - - if (PG(register_globals)) { - for (i = 0; i < 5; i++) { - if (PG(http_globals)[i]) { - php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[i]) TSRMLS_CC); - } + if (PG(register_globals)) { + php_autoglobal_merge(&EG(symbol_table), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]) TSRMLS_CC); } } @@ -1491,12 +1504,34 @@ array_init(form_variables); INIT_PZVAL(form_variables); - for (i = 0; i < 3; i++) { - if (_gpc_flags[i]) { - php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[(_gpc_flags[i] - 1)]) TSRMLS_CC); + _gpc_flags[0] = _gpc_flags[1] = _gpc_flags[2] = 0; + + for (p=variables_order; p && *p; p++) { + switch(*p) { + case 'g': + case 'G': + if (!_gpc_flags[1]) { + php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]) TSRMLS_CC); + _gpc_flags[1] = 1; + } + break; + case 'p': + case 'P': + if (!_gpc_flags[0]) { + php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]) TSRMLS_CC); + _gpc_flags[0] = 1; + } + break; + case 'c': + case 'C': + if (!_gpc_flags[2]) { + php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC); + _gpc_flags[2] = 1; + } + break; } } - + zend_hash_update(&EG(symbol_table), "_REQUEST", sizeof("_REQUEST"), &form_variables, sizeof(zval *), NULL); } Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.315 php-src/NEWS:1.1247.2.316 --- php-src/NEWS:1.1247.2.315 Thu Jul 31 15:48:05 2003 +++ php-src/NEWS Thu Jul 31 19:00:21 2003 @@ -3,6 +3,7 @@ ?? Aug 2003, Version 4.3.3RC3 - Fixed bug #22154 (Possible crash when memory_limit is reached and output buffering in addition to session.use_trans_sid is used). (Ilia) +- Fixed bug #24883 (variables_order and gpc_order being ignored). (Ilia) 30 Jul 2003, Version 4.3.3RC2 - Improved the NSAPI SAPI module (Uwe Schindler)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php