From a8196960bcaace8a2a1506040d9a776c140eb9dd Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 18 Jan 2025 23:43:25 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp_xmlrpc_server::pingback_ping()`. Follow-up to [2983], [55365]. Props aristath, poena, afercia, SergeyBiryukov. See #62279. Built from https://develop.svn.wordpress.org/trunk@59663 git-svn-id: http://core.svn.wordpress.org/trunk@59006 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-xmlrpc-server.php | 7 ++++--- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 84f64967a4..cbcf0a9b52 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -6885,6 +6885,7 @@ class wp_xmlrpc_server extends IXR_Server { */ $urltest = parse_url( $pagelinkedto ); $post_id = url_to_postid( $pagelinkedto ); + if ( $post_id ) { // $way } elseif ( isset( $urltest['path'] ) && preg_match( '#p/[0-9]{1,}#', $urltest['path'], $match ) ) { @@ -6917,15 +6918,15 @@ class wp_xmlrpc_server extends IXR_Server { // TODO: Attempt to extract a post ID from the given URL. return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } - $post_id = (int) $post_id; - $post = get_post( $post_id ); + $post_id = (int) $post_id; + $post = get_post( $post_id ); if ( ! $post ) { // Post not found. return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either does not exist, or it is not a pingback-enabled resource.' ) ); } - if ( url_to_postid( $pagelinkedfrom ) == $post_id ) { + if ( url_to_postid( $pagelinkedfrom ) === $post_id ) { return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 4f4ea25d29..d8d46e1858 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59662'; +$wp_version = '6.8-alpha-59663'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.