哪些超全局变量受magic_quotes_gpc = 1影响? [英] Which superglobals are affected by magic_quotes_gpc = 1?

查看:278
本文介绍了哪些超全局变量受magic_quotes_gpc = 1影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过查看此伪指令的名称,可能会认为magic_quotes仅适用于$_GET$_POST$_COOKIE超全局变量,但是有

By looking at the name of this directive one may think that magic_quotes are only applied to $_GET, $_POST and $_COOKIE superglobals but there is one perturbing comment on the PHP Manual:

请注意, 不仅设置了magic_quotes_gpc $_POST$_GET$_REQUEST$_COOKIE 数组值被斜线了.实际上 $GLOBALS数组中的每个字符串值 被削减,即. $GLOBALS['_SERVER']['PATH_INFO'](或 $_SERVER['PATH_INFO']).

Please note, that when magic_quotes_gpc is set not only $_POST, $_GET, $_REQUEST, $_COOKIE arrays values are slashed. Actually every string value in $GLOBALS array is slashed, ie. $GLOBALS['_SERVER']['PATH_INFO'] (or $_SERVER['PATH_INFO']).

任何人都可以确认这是真的吗?超全局变量$GLOBALS$_SERVER$_FILES$_SESSION$_ENV也受到影响吗?

Can anyone confirm that this is true? Are the superglobals $GLOBALS, $_SERVER, $_FILES, $_SESSION and $_ENV affected as well?

另一个问题,如果我在$_GET$_POST$_COOKIE数组上迭代stripslashes(),是否还需要遍历$_REQUEST数组?还是会自动反映出更改?

One more question, if I iterate stripslashes() over the $_GET, $_POST and $_COOKIE arrays do I also need to iterate through the $_REQUEST array? Or are the changes automatically reflected?

推荐答案

我已经对LightTPD 1.4.20PHP 5.3.0进行了一些测试,其中magic_quotes_gpc = On$_SERVER并未更改(至少[SERVER_NAME] => local'host没有'). $_SESSION也不受magic_quotes的影响.

I've run some tests on LightTPD 1.4.20 and PHP 5.3.0 with magic_quotes_gpc = On and $_SERVER wasn't altered (at least [SERVER_NAME] => local'host didn't). $_SESSION also isn't affected by magic_quotes.

$_GET$_POST$_COOKIE$_REQUEST(及其对应的$GLOBALS)受到了影响.

$_GET, $_POST, $_COOKIE and $_REQUEST were affected (and their $GLOBALS counterparts).

此外,GPC超全局变量中的更改不会自动反映在$_REQUEST 中.

Also, the changes in the GPC superglobals aren't automatically reflected in $_REQUEST.

对于$_FILES$_ENV超全局变量,我无法对其进行ATM测试.

As for the $_FILES and $_ENV superglobals I'm not able to test them ATM.

我终于运行了该测试,令我惊讶的是$_FILESphp://input 都受到了的影响.

I've finally ran this test and, to my surprise, both $_FILES and php://input are affected.

这篇关于哪些超全局变量受magic_quotes_gpc = 1影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆