Coding Standards: Rename the `$strResponse` variable to `$response` in `WP_Http_Streams::request()`.
This fixes a `Variable "$strResponse" is not in valid snake_case format` WPCS warning. For consistency, this commit also renames the `WP_Http::processResponse()` argument to `$response`. Follow-up to [8516], [51825], [51929], [51940], [52025], [52960], [52961], [52962], [52963]. Props azouamauriac. See #54728. Built from https://develop.svn.wordpress.org/trunk@52964 git-svn-id: http://core.svn.wordpress.org/trunk@52553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0c8714dcda
commit
010c5d4f89
|
@ -263,7 +263,7 @@ class WP_Http_Streams {
|
|||
);
|
||||
}
|
||||
|
||||
$strResponse = '';
|
||||
$response = '';
|
||||
$body_started = false;
|
||||
$keep_reading = true;
|
||||
$block_size = 4096;
|
||||
|
@ -297,12 +297,12 @@ class WP_Http_Streams {
|
|||
while ( ! feof( $handle ) && $keep_reading ) {
|
||||
$block = fread( $handle, $block_size );
|
||||
if ( ! $body_started ) {
|
||||
$strResponse .= $block;
|
||||
if ( strpos( $strResponse, "\r\n\r\n" ) ) {
|
||||
$processed_response = WP_Http::processResponse( $strResponse );
|
||||
$response .= $block;
|
||||
if ( strpos( $response, "\r\n\r\n" ) ) {
|
||||
$processed_response = WP_Http::processResponse( $response );
|
||||
$body_started = true;
|
||||
$block = $processed_response['body'];
|
||||
unset( $strResponse );
|
||||
unset( $response );
|
||||
$processed_response['body'] = '';
|
||||
}
|
||||
}
|
||||
|
@ -338,23 +338,23 @@ class WP_Http_Streams {
|
|||
$header_length = 0;
|
||||
|
||||
while ( ! feof( $handle ) && $keep_reading ) {
|
||||
$block = fread( $handle, $block_size );
|
||||
$strResponse .= $block;
|
||||
$block = fread( $handle, $block_size );
|
||||
$response .= $block;
|
||||
|
||||
if ( ! $body_started && strpos( $strResponse, "\r\n\r\n" ) ) {
|
||||
$header_length = strpos( $strResponse, "\r\n\r\n" ) + 4;
|
||||
if ( ! $body_started && strpos( $response, "\r\n\r\n" ) ) {
|
||||
$header_length = strpos( $response, "\r\n\r\n" ) + 4;
|
||||
$body_started = true;
|
||||
}
|
||||
|
||||
$keep_reading = (
|
||||
! $body_started
|
||||
|| ! isset( $parsed_args['limit_response_size'] )
|
||||
|| strlen( $strResponse ) < ( $header_length + $parsed_args['limit_response_size'] )
|
||||
|| strlen( $response ) < ( $header_length + $parsed_args['limit_response_size'] )
|
||||
);
|
||||
}
|
||||
|
||||
$processed_response = WP_Http::processResponse( $strResponse );
|
||||
unset( $strResponse );
|
||||
$processed_response = WP_Http::processResponse( $response );
|
||||
unset( $response );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -655,7 +655,7 @@ class WP_Http {
|
|||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @param string $str_response The full response string.
|
||||
* @param string $response The full response string.
|
||||
* @return array {
|
||||
* Array with response headers and body.
|
||||
*
|
||||
|
@ -663,8 +663,8 @@ class WP_Http {
|
|||
* @type string $body HTTP response body.
|
||||
* }
|
||||
*/
|
||||
public static function processResponse( $str_response ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
|
||||
$response = explode( "\r\n\r\n", $str_response, 2 );
|
||||
public static function processResponse( $response ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
|
||||
$response = explode( "\r\n\r\n", $response, 2 );
|
||||
|
||||
return array(
|
||||
'headers' => $response[0],
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-52963';
|
||||
$wp_version = '6.0-alpha-52964';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue