XML-RPC: Avoid a PHP notice in `::pingback_ping()` if page title was not found.

Props RedSand.
Fixes #36727.
Built from https://develop.svn.wordpress.org/trunk@38620


git-svn-id: http://core.svn.wordpress.org/trunk@38563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2016-09-18 14:26:29 +00:00
parent 34a7bc4e67
commit 788c3680f9
2 changed files with 5 additions and 4 deletions

View File

@ -6323,9 +6323,10 @@ class wp_xmlrpc_server extends IXR_Server {
$remote_source = preg_replace( "/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $remote_source );
preg_match( '|<title>([^<]*?)</title>|is', $remote_source, $matchtitle );
$title = $matchtitle[1];
if ( empty( $title ) )
return $this->pingback_error( 32, __('We cannot find a title on that page.' ) );
$title = isset( $matchtitle[1] ) ? $matchtitle[1] : '';
if ( empty( $title ) ) {
return $this->pingback_error( 32, __( 'We cannot find a title on that page.' ) );
}
$remote_source = strip_tags( $remote_source, '<a>' ); // just keep the tag we need

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38619';
$wp_version = '4.7-alpha-38620';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.