From b4f299c6f9bd7c5b4081fb6de53742b7ab465583 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Wed, 23 Dec 2015 01:42:25 +0000 Subject: [PATCH] In `WP::handle_404()`, make sure `$wp_query->post` is a `WP_Post` object before cloning it. Merges [35994] to the 4.4 branch. Props igmoweb, swissspidy. Fixes #35013. Built from https://develop.svn.wordpress.org/branches/4.4@36064 git-svn-id: http://core.svn.wordpress.org/branches/4.4@36029 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp.php | 7 ++++++- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp.php b/wp-includes/class-wp.php index bcb8606336..3685305a26 100644 --- a/wp-includes/class-wp.php +++ b/wp-includes/class-wp.php @@ -609,7 +609,12 @@ class WP { $success = true; if ( is_singular() ) { - $p = clone $wp_query->post; + $p = false; + + if ( $wp_query->post instanceof WP_Post ) { + $p = clone $wp_query->post; + } + // Only set X-Pingback for single posts that allow pings. if ( $p && pings_open( $p ) ) { @header( 'X-Pingback: ' . get_bloginfo( 'pingback_url' ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 553858668b..c0e74f5aae 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4.1-alpha-36063'; +$wp_version = '4.4.1-alpha-36064'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.