<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56664] trunk: Security: remove the cron event that checked for https support.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/56664">56664</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/56664","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>adamsilverstein</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-09-22 19:06:45 +0000 (Fri, 22 Sep 2023)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Security: remove the cron event that checked for https support.
Fix an issue where a cron job ran every 12 hours to check for https support - even when https support was already enabled. The check is now run only when the user visits the Site Health page. Reducing the unneeded requests lowers the impact and load of hosting WordPress sites.
The `wp_update_https_detection_errors` function is deprecated and the `https_detection_errors` option that was previously set by the cron job is no longer maintained. The `pre_wp_update_https_detection_errors` filter is deprecated and replaced by the `pre_wp_get_https_detection_errors` filter which serves the same function.
Props audrasjb, johnbillion, Michi91.
Fixes <a href="https://core.trac.wordpress.org/ticket/58494">#58494</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesclasswpsitehealthphp">trunk/src/wp-admin/includes/class-wp-site-health.php</a></li>
<li><a href="#trunksrcwpadminincludesupgradephp">trunk/src/wp-admin/includes/upgrade.php</a></li>
<li><a href="#trunksrcwpincludesdefaultfiltersphp">trunk/src/wp-includes/default-filters.php</a></li>
<li><a href="#trunksrcwpincludesdeprecatedphp">trunk/src/wp-includes/deprecated.php</a></li>
<li><a href="#trunksrcwpincludeshttpsdetectionphp">trunk/src/wp-includes/https-detection.php</a></li>
<li><a href="#trunktestsphpunittestshttpsdetectionphp">trunk/tests/phpunit/tests/https-detection.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesclasswpsitehealthphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-site-health.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-site-health.php 2023-09-22 18:17:44 UTC (rev 56663)
+++ trunk/src/wp-admin/includes/class-wp-site-health.php 2023-09-22 19:06:45 UTC (rev 56664)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1555,10 +1555,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_test_https_status() {
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Enforce fresh HTTPS detection results. This is normally invoked by using cron,
- * but for Site Health it should always rely on the latest results.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Check HTTPS detection results.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_update_https_detection_errors();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $errors = wp_get_https_detection_errors();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $default_update_url = wp_get_default_update_https_url();
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpadminincludesupgradephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/upgrade.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/upgrade.php 2023-09-22 18:17:44 UTC (rev 56663)
+++ trunk/src/wp-admin/includes/upgrade.php 2023-09-22 19:06:45 UTC (rev 56664)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2340,6 +2340,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $wp_current_db_version < 56657 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Enable attachment pages.
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'wp_attachment_pages_enabled', 1 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Remove the wp_https_detection cron. Https status is checked directly in an async Site Health check.
+ $scheduled = wp_get_scheduled_event( 'wp_https_detection' );
+ if ( $scheduled ) {
+ wp_clear_scheduled_hook( 'wp_https_detection' );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/default-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/default-filters.php 2023-09-22 18:17:44 UTC (rev 56663)
+++ trunk/src/wp-includes/default-filters.php 2023-09-22 19:06:45 UTC (rev 56664)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -387,11 +387,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'init', 'wp_cron' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// HTTPS detection.
-add_action( 'init', 'wp_schedule_https_detection' );
-add_action( 'wp_https_detection', 'wp_update_https_detection_errors' );
-add_filter( 'cron_request', 'wp_cron_conditionally_prevent_sslverify', 9999 );
-
</del><span class="cx" style="display: block; padding: 0 10px"> // HTTPS migration.
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'update_option_home', 'wp_update_https_migration_required', 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesdeprecatedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/deprecated.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/deprecated.php 2023-09-22 18:17:44 UTC (rev 56663)
+++ trunk/src/wp-includes/deprecated.php 2023-09-22 19:06:45 UTC (rev 56664)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5870,3 +5870,41 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_enqueue_scripts', $fn_generate_and_enqueue_styles );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors.
+ *
+ * This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained.
+ *
+ * @since 5.7.0
+ * @deprecated 6.4.0 The `wp_update_https_detection_errors()` function is no longer used and has been replaced by
+ * `wp_get_https_detection_errors()`. Previously the function was called by a regular Cron hook to
+ * update the `https_detection_errors` option, but this is no longer necessary as the errors are
+ * retrieved directly in Site Health and no longer used outside of Site Health.
+ * @access private
+ */
+function wp_update_https_detection_errors() {
+ _deprecated_function( __FUNCTION__, '6.4.0' );
+
+ /**
+ * Short-circuits the process of detecting errors related to HTTPS support.
+ *
+ * Returning a `WP_Error` from the filter will effectively short-circuit the default logic of trying a remote
+ * request to the site over HTTPS, storing the errors array from the returned `WP_Error` instead.
+ *
+ * @since 5.7.0
+ * @deprecated 6.4.0 The `wp_update_https_detection_errors` filter is no longer used and has been replaced by `pre_wp_get_https_detection_errors`.
+ *
+ * @param null|WP_Error $pre Error object to short-circuit detection,
+ * or null to continue with the default behavior.
+ */
+ $support_errors = apply_filters( 'pre_wp_update_https_detection_errors', null );
+ if ( is_wp_error( $support_errors ) ) {
+ update_option( 'https_detection_errors', $support_errors->errors );
+ return;
+ }
+
+ $support_errors = wp_get_https_detection_errors();
+
+ update_option( 'https_detection_errors', $support_errors );
+}
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludeshttpsdetectionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/https-detection.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/https-detection.php 2023-09-22 18:17:44 UTC (rev 56663)
+++ trunk/src/wp-includes/https-detection.php 2023-09-22 19:06:45 UTC (rev 56664)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,10 +86,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 5.7.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.4.0
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_update_https_detection_errors() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_get_https_detection_errors() {
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Short-circuits the process of detecting errors related to HTTPS support.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,15 +96,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Returning a `WP_Error` from the filter will effectively short-circuit the default logic of trying a remote
</span><span class="cx" style="display: block; padding: 0 10px"> * request to the site over HTTPS, storing the errors array from the returned `WP_Error` instead.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 5.7.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.4.0
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param null|WP_Error $pre Error object to short-circuit detection,
</span><span class="cx" style="display: block; padding: 0 10px"> * or null to continue with the default behavior.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return null|WP_Error Error object if HTTPS detection errors are found, null otherwise.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $support_errors = apply_filters( 'pre_wp_update_https_detection_errors', null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $support_errors = apply_filters( 'pre_wp_get_https_detection_errors', null );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_wp_error( $support_errors ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_option( 'https_detection_errors', $support_errors->errors );
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $support_errors->errors;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $support_errors = new WP_Error();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -153,44 +153,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_option( 'https_detection_errors', $support_errors->errors );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $support_errors->errors;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Schedules the Cron hook for detecting HTTPS support.
- *
- * @since 5.7.0
- * @access private
- */
-function wp_schedule_https_detection() {
- if ( wp_installing() ) {
- return;
- }
-
- if ( ! wp_next_scheduled( 'wp_https_detection' ) ) {
- wp_schedule_event( time(), 'twicedaily', 'wp_https_detection' );
- }
-}
-
-/**
- * Disables SSL verification if the 'cron_request' arguments include an HTTPS URL.
- *
- * This prevents an issue if HTTPS breaks, where there would be a failed attempt to verify HTTPS.
- *
- * @since 5.7.0
- * @access private
- *
- * @param array $request The cron request arguments.
- * @return array The filtered cron request arguments.
- */
-function wp_cron_conditionally_prevent_sslverify( $request ) {
- if ( 'https' === wp_parse_url( $request['url'], PHP_URL_SCHEME ) ) {
- $request['args']['sslverify'] = false;
- }
- return $request;
-}
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px"> * Checks whether a given HTML string is likely an output from this WordPress site.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This function attempts to check for various common WordPress patterns whether they are included in the HTML string.
</span></span></pre></div>
<a id="trunktestsphpunittestshttpsdetectionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/https-detection.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/https-detection.php 2023-09-22 18:17:44 UTC (rev 56663)
+++ trunk/tests/phpunit/tests/https-detection.php 2023-09-22 19:06:45 UTC (rev 56664)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -56,122 +56,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 47577
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @ticket 52484
- */
- public function test_wp_update_https_detection_errors() {
- // Set HTTP URL, the request below should use its HTTPS version.
- update_option( 'home', 'http://example.com/' );
- add_filter( 'pre_http_request', array( $this, 'record_request_url' ), 10, 3 );
-
- // If initial request succeeds, all good.
- add_filter( 'pre_http_request', array( $this, 'mock_success_with_sslverify' ), 10, 2 );
- wp_update_https_detection_errors();
- $this->assertSame( array(), get_option( 'https_detection_errors' ) );
-
- // If initial request fails and request without SSL verification succeeds,
- // return 'ssl_verification_failed' error.
- add_filter( 'pre_http_request', array( $this, 'mock_error_with_sslverify' ), 10, 2 );
- add_filter( 'pre_http_request', array( $this, 'mock_success_without_sslverify' ), 10, 2 );
- wp_update_https_detection_errors();
- $this->assertSame(
- array( 'ssl_verification_failed' => array( __( 'SSL verification failed.' ) ) ),
- get_option( 'https_detection_errors' )
- );
-
- // If both initial request and request without SSL verification fail,
- // return 'https_request_failed' error.
- add_filter( 'pre_http_request', array( $this, 'mock_error_with_sslverify' ), 10, 2 );
- add_filter( 'pre_http_request', array( $this, 'mock_error_without_sslverify' ), 10, 2 );
- wp_update_https_detection_errors();
- $this->assertSame(
- array( 'https_request_failed' => array( __( 'HTTPS request failed.' ) ) ),
- get_option( 'https_detection_errors' )
- );
-
- // If request succeeds, but response is not 200, return error with
- // 'bad_response_code' error code.
- add_filter( 'pre_http_request', array( $this, 'mock_not_found' ), 10, 2 );
- wp_update_https_detection_errors();
- $this->assertSame(
- array( 'bad_response_code' => array( 'Not Found' ) ),
- get_option( 'https_detection_errors' )
- );
-
- // If request succeeds, but response was not generated by this
- // WordPress site, return error with 'bad_response_source' error code.
- add_filter( 'pre_http_request', array( $this, 'mock_bad_source' ), 10, 2 );
- wp_update_https_detection_errors();
- $this->assertSame(
- array( 'bad_response_source' => array( 'It looks like the response did not come from this site.' ) ),
- get_option( 'https_detection_errors' )
- );
-
- // Check that the requests are made to the correct URL.
- $this->assertSame( 'https://example.com/', $this->last_request_url );
- }
-
- /**
- * @ticket 47577
- */
- public function test_pre_wp_update_https_detection_errors() {
- // Override to enforce no errors being detected.
- add_filter(
- 'pre_wp_update_https_detection_errors',
- static function () {
- return new WP_Error();
- }
- );
- wp_update_https_detection_errors();
- $this->assertSame( array(), get_option( 'https_detection_errors' ) );
-
- // Override to enforce an error being detected.
- add_filter(
- 'pre_wp_update_https_detection_errors',
- static function () {
- return new WP_Error(
- 'ssl_verification_failed',
- 'Bad SSL certificate.'
- );
- }
- );
- wp_update_https_detection_errors();
- $this->assertSame(
- array( 'ssl_verification_failed' => array( 'Bad SSL certificate.' ) ),
- get_option( 'https_detection_errors' )
- );
- }
-
- /**
- * @ticket 47577
- */
- public function test_wp_schedule_https_detection() {
- wp_schedule_https_detection();
- $this->assertSame( 'twicedaily', wp_get_schedule( 'wp_https_detection' ) );
- }
-
- /**
- * @ticket 47577
- */
- public function test_wp_cron_conditionally_prevent_sslverify() {
- // If URL is not using HTTPS, don't set 'sslverify' to false.
- $request = array(
- 'url' => 'http://example.com/',
- 'args' => array( 'sslverify' => true ),
- );
- $this->assertSame( $request, wp_cron_conditionally_prevent_sslverify( $request ) );
-
- // If URL is using HTTPS, set 'sslverify' to false.
- $request = array(
- 'url' => 'https://example.com/',
- 'args' => array( 'sslverify' => true ),
- );
- $expected = $request;
- $expected['args']['sslverify'] = false;
- $this->assertSame( $expected, wp_cron_conditionally_prevent_sslverify( $request ) );
- }
-
- /**
- * @ticket 47577
</del><span class="cx" style="display: block; padding: 0 10px"> * @ticket 52542
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_wp_is_local_html_output_via_rsd_link() {
</span></span></pre>
</div>
</div>
</body>
</html>