admin管理员组文章数量:1323737
I moved a WordPress site from one domain to another and there were a lot of white spaces that needed to be removed.
The only problem that is left are the following errors:
- PHP Notice: Undefined offset: 0 in /home/linguist/public_html/test/wp-includes/plugin.php on line 767
- PHP Notice: Undefined offset: 0 in /home/linguist/public_html/test/wp-includes/plugin.php on line 785
then further
PHP Warning: Cannot modify header information - headers already sent by (output started at /home/linguist/public_html/test/wp-includes/plugin.php:767)
Its all due to this code which hasn't been changed at all but is creating errors.
if (is_object($function[0]) ) {
// Object Class Calling
if ( function_exists('spl_object_hash') ) {
return spl_object_hash($function[0]) . $function[1];
} else {
$obj_idx = get_class($function[0]).$function[1];
if ( !isset($function[0]->wp_filter_id) ) {
if ( false === $priority )
return false;
$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : $filter_id_count;
$function[0]->wp_filter_id = $filter_id_count;
++$filter_id_count;
} else {
$obj_idx .= $function[0]->wp_filter_id;
}
return $obj_idx;
}
} else if ( is_string($function[0]) ) {
// Static Calling
return $function[0].$function[1];
}
}
Could someone please help me with this?
I moved a WordPress site from one domain to another and there were a lot of white spaces that needed to be removed.
The only problem that is left are the following errors:
- PHP Notice: Undefined offset: 0 in /home/linguist/public_html/test/wp-includes/plugin.php on line 767
- PHP Notice: Undefined offset: 0 in /home/linguist/public_html/test/wp-includes/plugin.php on line 785
then further
PHP Warning: Cannot modify header information - headers already sent by (output started at /home/linguist/public_html/test/wp-includes/plugin.php:767)
Its all due to this code which hasn't been changed at all but is creating errors.
if (is_object($function[0]) ) {
// Object Class Calling
if ( function_exists('spl_object_hash') ) {
return spl_object_hash($function[0]) . $function[1];
} else {
$obj_idx = get_class($function[0]).$function[1];
if ( !isset($function[0]->wp_filter_id) ) {
if ( false === $priority )
return false;
$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : $filter_id_count;
$function[0]->wp_filter_id = $filter_id_count;
++$filter_id_count;
} else {
$obj_idx .= $function[0]->wp_filter_id;
}
return $obj_idx;
}
} else if ( is_string($function[0]) ) {
// Static Calling
return $function[0].$function[1];
}
}
Could someone please help me with this?
Share Improve this question asked Apr 12, 2013 at 11:10 user31377user31377 211 gold badge1 silver badge2 bronze badges 1- You remove whitespaces? Where do you remove them? This code is throwing an error because it is called with a wrong parameter. So the real error is at another palce. – Ralf912 Commented Apr 12, 2013 at 11:50
3 Answers
Reset to default 4Some code on your site registers a filter or an action with invalid arguments. The errors you see happen, because add_action()
or add_filter()
was called with a second argument that is not a string, an object or an array.
Examples:
add_action( 'wp_head', NULL );
add_filter( 'the_content', -1 );
Disable all plugins, switch to Twenty Eleven, and re-enable everything until the errors comes back. Then find all calls to add_action()
or add_filter()
.
You can find out which command is the reason. Add the following code before the line "if ( is_object( $function[0] ) ) {"
if(!isset($function[0])){
var_dump($tag);
var_dump($function);
var_dump($priority);
die();
}
PHP Warning: Cannot modify header information - headers already sent by (output started at /home/linguist/public_html/test/wp-includes/plugin.php:767)
you just put ob_start() in your functions.php at the top of the line.
本文标签: Pluginphp PHP Notice Undefined offset 0 in
版权声明:本文标题:Plugin.php: PHP Notice: Undefined offset: 0 in 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742119595a2421634.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论