From 54aeb1d515c8a6f3a44d937dbe4646a59f8f7a2f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 30 Dec 2024 09:32:20 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `get_post_ancestors()`. Follow-up to [7074], [15758], [21559], [21953]. Props aristath, poena, afercia, SergeyBiryukov. See #62279. Built from https://develop.svn.wordpress.org/trunk@59566 git-svn-id: http://core.svn.wordpress.org/trunk@58952 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 6 ++++-- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index cadc929457..dfdd41ed5e 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1135,7 +1135,7 @@ function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) { function get_post_ancestors( $post ) { $post = get_post( $post ); - if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID ) { + if ( ! $post || empty( $post->post_parent ) || $post->post_parent === $post->ID ) { return array(); } @@ -1146,7 +1146,9 @@ function get_post_ancestors( $post ) { while ( $ancestor = get_post( $id ) ) { // Loop detection: If the ancestor has been seen before, break. - if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors, true ) ) { + if ( empty( $ancestor->post_parent ) || $ancestor->post_parent === $post->ID + || in_array( $ancestor->post_parent, $ancestors, true ) + ) { break; } diff --git a/wp-includes/version.php b/wp-includes/version.php index e676469f04..91297442ab 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59565'; +$wp_version = '6.8-alpha-59566'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.