Ticket #8620: 8620.diff
File 8620.diff, 4.0 KB (added by , 14 years ago) |
---|
-
wp-includes/http.php
1898 1898 * 1899 1899 * @param string $url Site URL to retrieve. 1900 1900 * @param array $args Optional. Override the defaults. 1901 * @return WP_Error| string The body of the response or WP_Error on failure.1901 * @return WP_Error|array The response or WP_Error on failure. 1902 1902 */ 1903 1903 function wp_remote_request($url, $args = array()) { 1904 1904 $objFetchSite = _wp_http_get_object(); … … 1914 1914 * 1915 1915 * @param string $url Site URL to retrieve. 1916 1916 * @param array $args Optional. Override the defaults. 1917 * @return WP_Error| string The body of the response or WP_Error on failure.1917 * @return WP_Error|array The response or WP_Error on failure. 1918 1918 */ 1919 1919 function wp_remote_get($url, $args = array()) { 1920 1920 $objFetchSite = _wp_http_get_object(); … … 1930 1930 * 1931 1931 * @param string $url Site URL to retrieve. 1932 1932 * @param array $args Optional. Override the defaults. 1933 * @return WP_Error| string The body of the response or WP_Error on failure.1933 * @return WP_Error|array The response or WP_Error on failure. 1934 1934 */ 1935 1935 function wp_remote_post($url, $args = array()) { 1936 1936 $objFetchSite = _wp_http_get_object(); … … 1946 1946 * 1947 1947 * @param string $url Site URL to retrieve. 1948 1948 * @param array $args Optional. Override the defaults. 1949 * @return WP_Error| string The body of the response or WP_Error on failure.1949 * @return WP_Error|array The response or WP_Error on failure. 1950 1950 */ 1951 1951 function wp_remote_head($url, $args = array()) { 1952 1952 $objFetchSite = _wp_http_get_object(); … … 1962 1962 * @return array The headers of the response. Empty array if incorrect parameter given. 1963 1963 */ 1964 1964 function wp_remote_retrieve_headers(&$response) { 1965 if ( ! isset($response['headers']) || ! is_array($response['headers']))1965 if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers'])) 1966 1966 return array(); 1967 1967 1968 1968 return $response['headers']; … … 1975 1975 * 1976 1976 * @param array $response 1977 1977 * @param string $header Header name to retrieve value from. 1978 * @return array The header value. Empty string on if incorrect parameter given.1978 * @return string The header value. Empty string on if incorrect parameter given, or if the header doesnt exist. 1979 1979 */ 1980 1980 function wp_remote_retrieve_header(&$response, $header) { 1981 if ( ! isset($response['headers']) || ! is_array($response['headers']))1981 if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers'])) 1982 1982 return ''; 1983 1983 1984 1984 if ( array_key_exists($header, $response['headers']) ) … … 1995 1995 * @since 2.7.0 1996 1996 * 1997 1997 * @param array $response HTTP response. 1998 * @return array The keys 'code' and 'message' give information on the response.1998 * @return string the response code. Empty string on incorrect parameter given. 1999 1999 */ 2000 2000 function wp_remote_retrieve_response_code(&$response) { 2001 if ( ! isset($response['response']) || ! is_array($response['response']))2001 if ( is_wp_error($response) ||! isset($response['response']) || ! is_array($response['response'])) 2002 2002 return ''; 2003 2003 2004 2004 return $response['response']['code']; … … 2012 2012 * @since 2.7.0 2013 2013 * 2014 2014 * @param array $response HTTP response. 2015 * @return array The keys 'code' and 'message' give information on the response.2015 * @return string The response message. Empty string on incorrect parameter given. 2016 2016 */ 2017 2017 function wp_remote_retrieve_response_message(&$response) { 2018 if ( ! isset($response['response']) || ! is_array($response['response']))2018 if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response'])) 2019 2019 return ''; 2020 2020 2021 2021 return $response['response']['message']; … … 2030 2030 * @return string The body of the response. Empty string if no body or incorrect parameter given. 2031 2031 */ 2032 2032 function wp_remote_retrieve_body(&$response) { 2033 if ( ! isset($response['body']) )2033 if ( is_wp_error($response) || ! isset($response['body']) ) 2034 2034 return ''; 2035 2035 2036 2036 return $response['body'];