From 144c5f760d85810dd0fa069b7f6966e4611424d2 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Sat, 21 Sep 2019 16:05:13 +0000 Subject: [PATCH] Site Health: Don't verify SSL certificate when testing the local site. The SSL certificate may be self-signed which prevents various tests from returning proper results. Since the Cron API and file editors don't verify the certificate the tests shouldn't either. Props Clorith, ocean90. Fixes #47957. git-svn-id: https://develop.svn.wordpress.org/trunk@46231 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-site-health-auto-updates.php | 4 +++- src/wp-admin/includes/class-wp-site-health.php | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/class-wp-site-health-auto-updates.php b/src/wp-admin/includes/class-wp-site-health-auto-updates.php index d61ec1a002..bbd5479829 100644 --- a/src/wp-admin/includes/class-wp-site-health-auto-updates.php +++ b/src/wp-admin/includes/class-wp-site-health-auto-updates.php @@ -95,6 +95,8 @@ class WP_Site_Health_Auto_Updates { $headers = array( 'Cache-Control' => 'no-cache', ); + /** This filter is documented in wp-includes/class-wp-http-streams.php */ + $sslverify = apply_filters( 'https_local_ssl_verify', false ); // Include Basic auth in loopback requests. if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { @@ -108,7 +110,7 @@ class WP_Site_Health_Auto_Updates { admin_url( 'site-health.php' ) ); - $test = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) ); + $test = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); if ( is_wp_error( $test ) ) { return array( diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php index 8ced4646bb..4e5b3c3bcc 100644 --- a/src/wp-admin/includes/class-wp-site-health.php +++ b/src/wp-admin/includes/class-wp-site-health.php @@ -1677,6 +1677,8 @@ class WP_Site_Health { 'Cache-Control' => 'no-cache', 'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ), ); + /** This filter is documented in wp-includes/class-wp-http-streams.php */ + $sslverify = apply_filters( 'https_local_ssl_verify', false ); // Include Basic auth in loopback requests. if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { @@ -1693,7 +1695,7 @@ class WP_Site_Health { $url ); - $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) ); + $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); if ( is_wp_error( $r ) ) { $result['status'] = 'critical'; @@ -2000,6 +2002,8 @@ class WP_Site_Health { $headers = array( 'Cache-Control' => 'no-cache', ); + /** This filter is documented in wp-includes/class-wp-http-streams.php */ + $sslverify = apply_filters( 'https_local_ssl_verify', false ); // Include Basic auth in loopback requests. if ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) ) { @@ -2008,7 +2012,7 @@ class WP_Site_Health { $url = admin_url(); - $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) ); + $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); if ( is_wp_error( $r ) ) { return (object) array(