From d3d5fbbfc79fc15e24b7ee8f99f2283cd124ebe9 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 7 Jun 2023 06:40:20 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp-includes/class-wp-http-streams.php`. Follow-up to [12424], [25224], [25303], [29852], [45667], [47808], [51825]. Props aristath, poena, afercia, SergeyBiryukov. See #57839. Built from https://develop.svn.wordpress.org/trunk@55886 git-svn-id: http://core.svn.wordpress.org/trunk@55398 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-http-streams.php | 15 ++++++++++----- wp-includes/version.php | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/wp-includes/class-wp-http-streams.php b/wp-includes/class-wp-http-streams.php index b0dc302a39..9ce881a2f1 100644 --- a/wp-includes/class-wp-http-streams.php +++ b/wp-includes/class-wp-http-streams.php @@ -126,8 +126,13 @@ class WP_Http_Streams { ) ); - $timeout = (int) floor( $parsed_args['timeout'] ); - $utimeout = $timeout == $parsed_args['timeout'] ? 0 : 1000000 * $parsed_args['timeout'] % 1000000; + $timeout = (int) floor( $parsed_args['timeout'] ); + $utimeout = 0; + + if ( $timeout !== (int) $parsed_args['timeout'] ) { + $utimeout = 1000000 * $parsed_args['timeout'] % 1000000; + } + $connect_timeout = max( $timeout, 1 ); // Store error number. @@ -217,8 +222,8 @@ class WP_Http_Streams { $include_port_in_host_header = ( ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) - || ( 'http' === $parsed_url['scheme'] && 80 != $parsed_url['port'] ) - || ( 'https' === $parsed_url['scheme'] && 443 != $parsed_url['port'] ) + || ( 'http' === $parsed_url['scheme'] && 80 !== $parsed_url['port'] ) + || ( 'https' === $parsed_url['scheme'] && 443 !== $parsed_url['port'] ) ); if ( $include_port_in_host_header ) { @@ -320,7 +325,7 @@ class WP_Http_Streams { $bytes_written_to_file = fwrite( $stream_handle, $block ); - if ( $bytes_written_to_file != $this_block_size ) { + if ( $bytes_written_to_file !== $this_block_size ) { fclose( $handle ); fclose( $stream_handle ); return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index f499c4f05a..060c726ba7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55885'; +$wp_version = '6.3-alpha-55886'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.