I could isolate the error a litte bit.
Responsible are the functions get_post in wp-includes/post.php
function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
global $wpdb;
$null = null;
if ( empty($post) ) {
if ( isset($GLOBALS['post']) )
$_post = & $GLOBALS['post'];
else
return $null;
} elseif ( is_object($post) && empty($post->filter) ) {
_get_post_ancestors($post);
$_post = sanitize_post($post, 'raw');
wp_cache_add($post->ID, $_post, 'posts');
} else {
if ( is_object($post) )
$post = $post->ID;
$post = (int) $post;
if ( ! $_post = wp_cache_get($post, 'posts') ) {
$_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post));
if ( ! $_post )
return $null;
_get_post_ancestors($_post);
$_post = sanitize_post($_post, 'raw');
wp_cache_add($_post->ID, $_post, 'posts');
}
}
if ($filter != 'raw')
$_post = sanitize_post($_post, $filter);
if ( $output == OBJECT ) {
return $_post;
} elseif ( $output == ARRAY_A ) {
$__post = get_object_vars($_post);
return $__post;
} elseif ( $output == ARRAY_N ) {
$__post = array_values(get_object_vars($_post));
return $__post;
} else {
return $_post;
}
}
and the function comments_open in wp-includes/comment-template.php.
function comments_open( $post_id=NULL ) {
$_post = get_post($post_id);
$open = ( 'open' == $_post->comment_status );
return apply_filters( 'comments_open', $open, $post_id );
}
With printf-debuging I found out, that in the function get_post, the return value $_post is an object and in comments_open, where it is called, it is no longer an opject but just a number. The number is the id of the current comment.
So I guess, there is rather an issue with my php set-up rather with wordpress. Unfortunately, I have no clue, where and how I can fix this.
Anyone any idea?