From ba7c01a09ce71df157ff40a24343543dde9c410f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 4 Aug 2023 11:58:25 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp-includes/revision.php`. Follow-up to [24414], [38118], [38433]. Props aristath, poena, afercia, SergeyBiryukov. See #58831. Built from https://develop.svn.wordpress.org/trunk@56359 git-svn-id: http://core.svn.wordpress.org/trunk@55871 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/revision.php | 14 ++++++-------- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/wp-includes/revision.php b/wp-includes/revision.php index e8bbcdbce4..d5a5829d7e 100644 --- a/wp-includes/revision.php +++ b/wp-includes/revision.php @@ -768,7 +768,7 @@ function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) { return $terms; } - if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id + if ( empty( $_REQUEST['post_format'] ) || $post->ID !== $post_id || 'post_format' !== $taxonomy || 'revision' === $post->post_type ) { return $terms; @@ -778,6 +778,7 @@ function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) { $terms = array(); } else { $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ); + if ( $term ) { $terms = array( $term ); // Can only have one post format. } @@ -804,13 +805,10 @@ function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { return $value; } - if ( empty( $_REQUEST['_thumbnail_id'] ) || - empty( $_REQUEST['preview_id'] ) || - $post->ID != $post_id || - '_thumbnail_id' !== $meta_key || - 'revision' === $post->post_type || - $post_id != $_REQUEST['preview_id'] ) { - + if ( empty( $_REQUEST['_thumbnail_id'] ) || empty( $_REQUEST['preview_id'] ) + || $post->ID !== $post_id || $post_id !== (int) $_REQUEST['preview_id'] + || '_thumbnail_id' !== $meta_key || 'revision' === $post->post_type + ) { return $value; } diff --git a/wp-includes/version.php b/wp-includes/version.php index efd4a31a43..40cb179f64 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56358'; +$wp_version = '6.4-alpha-56359'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.