全局变量作为数据源的PHP会话副作用警告 [英] PHP session side-effect warning with global variables as a source of data
问题描述
我试图托管一个给我的PHP网站。我看到这样的警告:
警告:未知:您的脚本可能
依赖于会话端 - 在PHP 4.2.3之前存在
的效果。请注意,
会话扩展
不会将全局变量视为数据源
,除非已启用
register_globals。您可以通过将
session.bug_compat_42或
session.bug_compat_warn分别设为关闭,
来禁用此功能和
警告。在未知在线 0
这是什么意思?如何在代码中追踪此问题的来源?
基本上,您的变量名称与您的名称相同会话。例如:
$ _ SESSION ['var1'] = null;
$ var1 ='something';
会重现此错误。您可以阻止PHP尝试查找现有变量并通过将这些行添加到脚本中来警告您:
ini_set(' session.bug_compat_warn',0);
ini_set('session.bug_compat_42',0);
这些值可以在php.ini或.htaccess中设定。
I'm trying to host a PHP web site that was given to me. I see this warning:
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0
What does this mean? How might I track down the source of this problem within the code?
basically you have a variable with the same name as your session. ex:
$_SESSION['var1'] = null;
$var1 = 'something';
which will reproduce this error. you can stop PHP from trying to find existing variables and warning you about them by adding these lines to your script:
ini_set('session.bug_compat_warn', 0);
ini_set('session.bug_compat_42', 0);
these values can be set in php.ini or .htaccess as well
这篇关于全局变量作为数据源的PHP会话副作用警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!