From cac236638263cae794d19c345cb18f046f51dcbb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 2 Sep 2014 02:05:48 +0000 Subject: [PATCH] Avoid PHP notices when checking for local requests in in WP_Http. props markoheijnen. fixes #29392. git-svn-id: https://develop.svn.wordpress.org/trunk@29661 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-http.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php index 4dee414262..8a23836385 100644 --- a/src/wp-includes/class-http.php +++ b/src/wp-includes/class-http.php @@ -201,11 +201,7 @@ class WP_Http { // Determine if this request is to OUR install of WordPress. $homeURL = parse_url( get_bloginfo( 'url' ) ); - if ( isset( $homeURL['host'] ) ) { - $r['local'] = ( $homeURL['host'] == $arrURL['host'] || 'localhost' == $arrURL['host'] ); - } else { - $r['local'] = false; - } + $r['local'] = 'localhost' == $arrURL['host'] || ( isset( $homeURL['host'] ) && $homeURL['host'] == $arrURL['host'] ); unset( $homeURL ); /* @@ -637,7 +633,7 @@ class WP_Http { $home = parse_url( get_option('siteurl') ); // Don't block requests back to ourselves by default. - if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] ) { + if ( 'localhost' == $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) { /** * Filter whether to block local requests through the proxy. * @@ -1732,7 +1728,7 @@ class WP_HTTP_Proxy { if ( ! is_null( $result ) ) return $result; - if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] ) + if ( 'localhost' == $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) return false; if ( !defined('WP_PROXY_BYPASS_HOSTS') )