Ticket #54728: 54728.5.diff
File 54728.5.diff, 6.7 KB (added by , 3 years ago) |
---|
-
src/wp-includes/class-wp-http-curl.php
258 258 curl_exec( $handle ); 259 259 260 260 $processed_headers = WP_Http::processHeaders( $this->headers, $url ); 261 $the Body= $this->body;261 $the_body = $this->body; 262 262 $bytes_written_total = $this->bytes_written_total; 263 263 264 264 $this->headers = ''; … … 268 268 $curl_error = curl_errno( $handle ); 269 269 270 270 // If an error occurred, or, no response. 271 if ( $curl_error || ( 0 == strlen( $the Body ) && empty( $processed_headers['headers'] ) ) ) {271 if ( $curl_error || ( 0 == strlen( $the_body ) && empty( $processed_headers['headers'] ) ) ) { 272 272 if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) { 273 273 if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) { 274 274 if ( $parsed_args['stream'] ) { … … 316 316 if ( true === $parsed_args['decompress'] 317 317 && true === WP_Http_Encoding::should_decode( $processed_headers['headers'] ) 318 318 ) { 319 $the Body = WP_Http_Encoding::decompress( $theBody );319 $the_body = WP_Http_Encoding::decompress( $the_body ); 320 320 } 321 321 322 $response['body'] = $the Body;322 $response['body'] = $the_body; 323 323 324 324 return $response; 325 325 } -
src/wp-includes/class-wp-http-streams.php
206 206 stream_set_timeout( $handle, $timeout, $utimeout ); 207 207 208 208 if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { // Some proxies require full URL in this field. 209 $request Path = $url;209 $request_path = $url; 210 210 } else { 211 $request Path = $parsed_url['path'] . ( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' );211 $request_path = $parsed_url['path'] . ( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' ); 212 212 } 213 213 214 $str Headers = strtoupper( $parsed_args['method'] ) . ' ' . $requestPath . ' HTTP/' . $parsed_args['httpversion'] . "\r\n";214 $str_headers = strtoupper( $parsed_args['method'] ) . ' ' . $request_path . ' HTTP/' . $parsed_args['httpversion'] . "\r\n"; 215 215 216 216 $include_port_in_host_header = ( 217 217 ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) … … 220 220 ); 221 221 222 222 if ( $include_port_in_host_header ) { 223 $str Headers .= 'Host: ' . $parsed_url['host'] . ':' . $parsed_url['port'] . "\r\n";223 $str_headers .= 'Host: ' . $parsed_url['host'] . ':' . $parsed_url['port'] . "\r\n"; 224 224 } else { 225 $str Headers .= 'Host: ' . $parsed_url['host'] . "\r\n";225 $str_headers .= 'Host: ' . $parsed_url['host'] . "\r\n"; 226 226 } 227 227 228 228 if ( isset( $parsed_args['user-agent'] ) ) { 229 $str Headers .= 'User-agent: ' . $parsed_args['user-agent'] . "\r\n";229 $str_headers .= 'User-agent: ' . $parsed_args['user-agent'] . "\r\n"; 230 230 } 231 231 232 232 if ( is_array( $parsed_args['headers'] ) ) { 233 foreach ( (array) $parsed_args['headers'] as $header => $header Value ) {234 $str Headers .= $header . ': ' . $headerValue . "\r\n";233 foreach ( (array) $parsed_args['headers'] as $header => $header_value ) { 234 $str_headers .= $header . ': ' . $header_value . "\r\n"; 235 235 } 236 236 } else { 237 $str Headers .= $parsed_args['headers'];237 $str_headers .= $parsed_args['headers']; 238 238 } 239 239 240 240 if ( $proxy->use_authentication() ) { 241 $str Headers .= $proxy->authentication_header() . "\r\n";241 $str_headers .= $proxy->authentication_header() . "\r\n"; 242 242 } 243 243 244 $str Headers .= "\r\n";244 $str_headers .= "\r\n"; 245 245 246 246 if ( ! is_null( $parsed_args['body'] ) ) { 247 $str Headers .= $parsed_args['body'];247 $str_headers .= $parsed_args['body']; 248 248 } 249 249 250 fwrite( $handle, $str Headers );250 fwrite( $handle, $str_headers ); 251 251 252 252 if ( ! $parsed_args['blocking'] ) { 253 253 stream_set_blocking( $handle, 0 ); … … 263 263 ); 264 264 } 265 265 266 $str Response= '';267 $body Started= false;266 $str_response = ''; 267 $body_started = false; 268 268 $keep_reading = true; 269 269 $block_size = 4096; 270 270 … … 296 296 297 297 while ( ! feof( $handle ) && $keep_reading ) { 298 298 $block = fread( $handle, $block_size ); 299 if ( ! $body Started ) {300 $str Response .= $block;301 if ( strpos( $str Response, "\r\n\r\n" ) ) {302 $processed_response = WP_Http::processResponse( $str Response );303 $body Started= true;299 if ( ! $body_started ) { 300 $str_response .= $block; 301 if ( strpos( $str_response, "\r\n\r\n" ) ) { 302 $processed_response = WP_Http::processResponse( $str_response ); 303 $body_started = true; 304 304 $block = $processed_response['body']; 305 unset( $str Response );305 unset( $str_response ); 306 306 $processed_response['body'] = ''; 307 307 } 308 308 } … … 338 338 $header_length = 0; 339 339 340 340 while ( ! feof( $handle ) && $keep_reading ) { 341 $block = fread( $handle, $block_size );342 $str Response .= $block;341 $block = fread( $handle, $block_size ); 342 $str_response .= $block; 343 343 344 if ( ! $body Started && strpos( $strResponse, "\r\n\r\n" ) ) {345 $header_length = strpos( $str Response, "\r\n\r\n" ) + 4;346 $body Started= true;344 if ( ! $body_started && strpos( $str_response, "\r\n\r\n" ) ) { 345 $header_length = strpos( $str_response, "\r\n\r\n" ) + 4; 346 $body_started = true; 347 347 } 348 348 349 349 $keep_reading = ( 350 ! $body Started350 ! $body_started 351 351 || ! isset( $parsed_args['limit_response_size'] ) 352 || strlen( $str Response ) < ( $header_length + $parsed_args['limit_response_size'] )352 || strlen( $str_response ) < ( $header_length + $parsed_args['limit_response_size'] ) 353 353 ); 354 354 } 355 355 356 $processed_response = WP_Http::processResponse( $str Response );357 unset( $str Response );356 $processed_response = WP_Http::processResponse( $str_response ); 357 unset( $str_response ); 358 358 359 359 } 360 360 -
src/wp-includes/category-template.php
103 103 * 104 104 * @since 0.71 105 105 * 106 * @param int $cat_ IDCategory ID.106 * @param int $cat_id Category ID. 107 107 * @return string|WP_Error Category name on success, WP_Error on failure. 108 108 */ 109 function get_the_category_by_ID( $cat_ ID) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid110 $cat_ ID = (int) $cat_ID;111 $category = get_term( $cat_ ID);109 function get_the_category_by_ID( $cat_id ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 110 $cat_id = (int) $cat_id; 111 $category = get_term( $cat_id ); 112 112 113 113 if ( is_wp_error( $category ) ) { 114 114 return $category;