I have implemented my own pingback client and sent out pingbacks to different hosts.
Some wordpress instances responded to the XML-RPC pingback request with a faultCode
of 0
and an empty faultMessage
.
What can be the cause for that?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI have implemented my own pingback client and sent out pingbacks to different hosts.
Some wordpress instances responded to the XML-RPC pingback request with a faultCode
of 0
and an empty faultMessage
.
What can be the cause for that?
For some reason, the default filter attached to pingback errors, will not send an error message unless the error code is 48. From wp-includes/commment.php
:
function xmlrpc_pingback_error( $ixr_error ) {
if ( $ixr_error->code === 48 )
return $ixr_error;
return new IXR_Error( 0, '' );
}
The standard Wordpress source only contains a single pingback error call with a faultCode of 0 and an empty message, in wp-includes/class-wp-xmlrpc-server.php
:
} elseif ( is_string($urltest['fragment']) ) {
// ...or a string #title, a little more complicated
$title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']);
$sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", like_escape( $title ) );
if (! ($post_ID = $wpdb->get_var($sql)) ) {
// returning unknown error '0' is better than die()ing
return $this->pingback_error( 0, '' );
}
$way = 'from the fragment (title)';
}
So the error can happen when the post cannot be determined from the URL and there is a fragment/anchor (#foo
) at the end of the URL. That fragment is interpreted as title and the posts table is searched for a post with exact this title.
Unfortunately, this can't be the reason in my case since I don't have anchors in the URLs.