PHP警告:foreach()提供的参数2和无效参数
我是新的代码,并试图确定我的网站上的错误。它是由一家使用PHP5.6的公司创建的,现在正在运行PHP7.3 调试文件有两个警告(我已将特定位置替换为…): PHP警告:WPE\Site\u Preview的参数2::应该是 作为参考,在…wp includes/class-wp-hook.php中给出的值 第288行PHP警告:中为foreach()提供的参数无效 …第1021行的wp content/mu plugins/wpengine common/plugin.php 我尝试在这里查找答案,foreach错误可能是因为它不是数组?但我不确定数组到底是什么,也不知道如何检查它。如果您有任何建议和建议,我们将不胜感激。很抱歉,我对这一点还不熟悉,而且还自学成才 第一个错误的代码(参数2应为参考)PHP警告:foreach()提供的参数2和无效参数,php,wordpress,foreach,Php,Wordpress,Foreach,我是新的代码,并试图确定我的网站上的错误。它是由一家使用PHP5.6的公司创建的,现在正在运行PHP7.3 调试文件有两个警告(我已将特定位置替换为…): PHP警告:WPE\Site\u Preview的参数2::应该是 作为参考,在…wp includes/class-wp-hook.php中给出的值 第288行PHP警告:中为foreach()提供的参数无效 …第1021行的wp content/mu plugins/wpengine common/plugin.php 我尝试在这里查找答
第二个错误的代码(为ACH提供的参数无效):
第一个错误的代码(参数2应该是一个引用)//如果可能,请避免使用数组_切片。如果($the_['accepted_args']==0){$value=call_user_func($the_['function']);}elseif($the_['accepted_args']>=$num_args){$value=call_user_func_数组($the_['function'],$args)}否则{$value=call u user_func_数组($the_['function'],数组($the_['function']),数组切片($args,0,(int)$the_['accepted_args'));第二个错误的代码(foreach提供的参数无效)。//有些路径可能会完全拒绝CDN——如果是这样,就不要进行CDN替换。//事实上,撤消W3TC所做的任何操作!$UNDO_CDN=false;foreach($re)if(preg_match('.$re.$re.'.'re.'uri)){$cdn_enabled=false;$undo_cdn=true;break;此信息需要在问题中,而不是在评论中。抱歉,已修复。谢谢。您肯定应该从这里开始:。。。
// Avoid the array_slice if possible.
if ( $the_['accepted_args'] == 0 ) {
$value = call_user_func( $the_['function'] );
} elseif ( $the_['accepted_args'] >= $num_args ) {
$value = call_user_func_array( $the_['function'], $args );
} else {
$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
// Some paths might reject CDN completely -- if so, don't do CDN replacements.
// In fact, UNDO any that were done by W3TC!
$undo_cdn = false;
foreach ( $wpe_no_cdn_uris as $re ) {
if ( preg_match( '#' . $re . '#', $uri ) ) {
$cdn_enabled = false;
$undo_cdn = true;
break;