mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed bug #29971 (variables_order behaviour)
This commit is contained in:
parent
47294288fe
commit
1add2cc70e
2 changed files with 27 additions and 2 deletions
|
@ -705,7 +705,15 @@ int php_hash_environment(TSRMLS_D)
|
||||||
|
|
||||||
static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS_DC)
|
static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS_DC)
|
||||||
{
|
{
|
||||||
php_register_server_variables(TSRMLS_C);
|
if (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s')) {
|
||||||
|
php_register_server_variables(TSRMLS_C);
|
||||||
|
} else {
|
||||||
|
zval *server_vars=NULL;
|
||||||
|
ALLOC_ZVAL(server_vars);
|
||||||
|
array_init(server_vars);
|
||||||
|
INIT_PZVAL(server_vars);
|
||||||
|
PG(http_globals)[TRACK_VARS_SERVER] = server_vars;
|
||||||
|
}
|
||||||
|
|
||||||
zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
|
zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
|
||||||
PG(http_globals)[TRACK_VARS_SERVER]->refcount++;
|
PG(http_globals)[TRACK_VARS_SERVER]->refcount++;
|
||||||
|
@ -726,7 +734,9 @@ static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC
|
||||||
INIT_PZVAL(env_vars);
|
INIT_PZVAL(env_vars);
|
||||||
PG(http_globals)[TRACK_VARS_ENV] = env_vars;
|
PG(http_globals)[TRACK_VARS_ENV] = env_vars;
|
||||||
|
|
||||||
php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
|
if (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e')) {
|
||||||
|
php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
|
||||||
|
}
|
||||||
|
|
||||||
zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
|
zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
|
||||||
PG(http_globals)[TRACK_VARS_ENV]->refcount++;
|
PG(http_globals)[TRACK_VARS_ENV]->refcount++;
|
||||||
|
|
15
tests/basic/bug29971.phpt
Executable file
15
tests/basic/bug29971.phpt
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #29971 (variables_order behaviour)
|
||||||
|
--INI--
|
||||||
|
variables_order=GPC
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
var_dump($_ENV,$_SERVER);
|
||||||
|
var_dump(ini_get("variables_order"));
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(0) {
|
||||||
|
}
|
||||||
|
array(0) {
|
||||||
|
}
|
||||||
|
string(3) "GPC"
|
Loading…
Add table
Add a link
Reference in a new issue