From fbb5ad3afc3823bbf42f16ffc7ec85d6208fc327 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sat, 26 Mar 2011 03:32:05 +0000 Subject: [PATCH] Correct logic for cURL Errors, add extra sanity protection in ::processHeaders to guard against null inputs. See #16236 git-svn-id: https://develop.svn.wordpress.org/trunk@17563 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/class-http.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index 25be416b6d..3f47fc4b95 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -359,7 +359,7 @@ class WP_Http { $cookies = array(); $newheaders = array(); - foreach ( $headers as $tempheader ) { + foreach ( (array) $headers as $tempheader ) { if ( empty($tempheader) ) continue; @@ -1121,7 +1121,7 @@ class WP_Http_Curl { * @access private * @var string */ - private $headers; + private $headers = ''; /** * Send a HTTP request to a URI using cURL extension. @@ -1259,7 +1259,7 @@ class WP_Http_Curl { $theBody = $theResponse; // If no response, and It's not a HEAD request with valid headers returned - if ( empty($theResponse) && 'HEAD' != $args['method'] && ! empty($this->headers) ) { + if ( empty($theResponse) && ('HEAD' != $args['method'] || empty($this->headers)) ) { if ( $curl_error = curl_error($handle) ) return new WP_Error('http_request_failed', $curl_error); if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) )