Skip to content

Commit

Permalink
XML-RPC: Avoid a PHP notice in ::pingback_ping() if page title was …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
SergeyBiryukov committed Sep 18, 2016
1 parent 34a7bc4 commit 788c368
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions wp-includes/class-wp-xmlrpc-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -6323,9 +6323,10 @@ public function pingback_ping( $args ) {
$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

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 788c368

Please sign in to comment.