From a828b700fc7838b2d9cc4c00d9c47ab61d359224 Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Mon, 28 Dec 2015 22:58:28 +0000 Subject: [PATCH] Comments: Return early from `wp_update_comment_count()` if there is not a valid post. Props ambrosey, juanfra. Fixes #34977 Built from https://develop.svn.wordpress.org/trunk@36115 git-svn-id: http://core.svn.wordpress.org/trunk@36080 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index a84f0a70b9..7dafa1eaef 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -2010,6 +2010,10 @@ function wp_defer_comment_counting($defer=null) { function wp_update_comment_count($post_id, $do_deferred=false) { static $_deferred = array(); + if ( empty( $post_id ) && ! $do_deferred ) { + return false; + } + if ( $do_deferred ) { $_deferred = array_unique($_deferred); foreach ( $_deferred as $i => $_post_id ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 3e1b55ba09..152dfc4d0b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36114'; +$wp_version = '4.5-alpha-36115'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.