简体   繁体   中英

$GLOBALS output while register_globals = off

register_globals is set "off".

phpinfo():
Local Value = Off
Master Value = Off

$var = "test";
function test()
{
    var_dump($GLOBALS["var"]);  // this prints "test"..
    die;
}
test();

Why do I get the output of $GLOBALS["var"] ?

$test = "mytext";
echo $GLOBALS["test"];  // output: "mytext".. why?
die;

Thanks for information!

Because register_globals controls whether $_GET , $_POST , cookie, environment and server parameters are automatically registered as globals or not. It does not disable the $GLOBALS variable; that's a core PHP mechanism that cannot be switched off.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM