From be88348a16832364b0cb92f21b7cf21bd8ab6883 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 14 Jun 2023 10:35:18 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp-includes/class-wp-oembed.php`. Follow-up to [13996]. Props aristath, poena, afercia, SergeyBiryukov. See #57839. Built from https://develop.svn.wordpress.org/trunk@55914 git-svn-id: http://core.svn.wordpress.org/trunk@55426 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-oembed.php | 10 +++++++++- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-oembed.php b/wp-includes/class-wp-oembed.php index 35cf16e74a..3cd365ba68 100644 --- a/wp-includes/class-wp-oembed.php +++ b/wp-includes/class-wp-oembed.php @@ -237,6 +237,7 @@ class WP_oEmbed { if ( in_array( $name, $this->compat_methods, true ) ) { return $this->$name( ...$arguments ); } + return false; } @@ -551,8 +552,10 @@ class WP_oEmbed { if ( is_wp_error( $result ) && 'not-implemented' === $result->get_error_code() ) { continue; } + return ( $result && ! is_wp_error( $result ) ) ? $result : false; } + return false; } @@ -572,14 +575,18 @@ class WP_oEmbed { $args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args ); $response = wp_safe_remote_get( $provider_url_with_args, $args ); - if ( 501 == wp_remote_retrieve_response_code( $response ) ) { + + if ( 501 === wp_remote_retrieve_response_code( $response ) ) { return new WP_Error( 'not-implemented' ); } + $body = wp_remote_retrieve_body( $response ); if ( ! $body ) { return false; } + $parse_method = "_parse_$format"; + return $this->$parse_method( $body ); } @@ -593,6 +600,7 @@ class WP_oEmbed { */ private function _parse_json( $response_body ) { $data = json_decode( trim( $response_body ) ); + return ( $data && is_object( $data ) ) ? $data : false; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 02481bcda3..d7d2244b3a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55913'; +$wp_version = '6.3-alpha-55914'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.