Permalink
Browse files

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
  • Loading branch information...
1 parent 34a7bc4 commit 788c3680f90b7570f8f9b5277f5d6bf57d7d9209 @SergeyBiryukov SergeyBiryukov committed Sep 18, 2016
Showing with 5 additions and 4 deletions.
  1. +4 −3 wp-includes/class-wp-xmlrpc-server.php
  2. +1 −1 wp-includes/version.php
@@ -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
@@ -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.

0 comments on commit 788c368

Please sign in to comment.