【发布时间】:2023-01-28 09:03:54
【问题描述】:
我以前从来没有遇到过这个错误,但现在因为我运行的是 php 8.1,所以这段代码已经过时了。
// addslashes to vars if magic_quotes_gpc is off
// this is a security precaution to prevent someone
// trying to break out of a SQL statement.
//
//if( !@get_magic_quotes_gpc() ){
ini_set('magic_quotes_runtime', 0);{
if( is_array($HTTP_GET_VARS) )
{
while( list($k, $v) = each($HTTP_GET_VARS) )
{
if( is_array($HTTP_GET_VARS[$k]) )
{
while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
{
$HTTP_GET_VARS[$k][$k2] = addslashes($v2);
}
@reset($HTTP_GET_VARS[$k]);
}
else
{
$HTTP_GET_VARS[$k] = addslashes($v);
【问题讨论】:
-
php.net/manual/en/function.each.php 该功能已被删除。
-
请不要将错误信息放在标题中
-
没有任何提及魔法引语的东西真的应该在生产中了。
In November 2005 the core PHP developers decided that because of these problems, the magic quotes feature would be removed from PHP 6。所以 17 年前,该功能计划被删除。