diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-includes/https-detection.php --- a/wp/wp-includes/https-detection.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-includes/https-detection.php Fri Sep 05 18:40:08 2025 +0200 @@ -49,9 +49,11 @@ * @return bool True if using HTTPS, false otherwise. */ function wp_is_site_url_using_https() { - // Use direct option access for 'siteurl' and manually run the 'site_url' - // filter because `site_url()` will adjust the scheme based on what the - // current request is using. + /* + * Use direct option access for 'siteurl' and manually run the 'site_url' + * filter because `site_url()` will adjust the scheme based on what the + * current request is using. + */ /** This filter is documented in wp-includes/link-template.php */ $site_url = apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null ); @@ -84,25 +86,25 @@ * * This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained. * - * @since 5.7.0 + * @since 6.4.0 * @access private */ -function wp_update_https_detection_errors() { +function wp_get_https_detection_errors() { /** * 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 + * @since 6.4.0 * * @param null|WP_Error $pre Error object to short-circuit detection, * or null to continue with the default behavior. + * @return null|WP_Error Error object if HTTPS detection errors are found, null otherwise. */ - $support_errors = apply_filters( 'pre_wp_update_https_detection_errors', null ); + $support_errors = apply_filters( 'pre_wp_get_https_detection_errors', null ); if ( is_wp_error( $support_errors ) ) { - update_option( 'https_detection_errors', $support_errors->errors ); - return; + return $support_errors->errors; } $support_errors = new WP_Error(); @@ -151,41 +153,7 @@ } } - update_option( 'https_detection_errors', $support_errors->errors ); -} - -/** - * 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; + return $support_errors->errors; } /** @@ -205,21 +173,14 @@ // 1. Check if HTML includes the site's Really Simple Discovery link. if ( has_action( 'wp_head', 'rsd_link' ) ) { $pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ) ); // See rsd_link(). - return false !== strpos( $html, $pattern ); + return str_contains( $html, $pattern ); } - // 2. Check if HTML includes the site's Windows Live Writer manifest link. - if ( has_action( 'wp_head', 'wlwmanifest_link' ) ) { - // Try both HTTPS and HTTP since the URL depends on context. - $pattern = preg_replace( '#^https?:(?=//)#', '', includes_url( 'wlwmanifest.xml' ) ); // See wlwmanifest_link(). - return false !== strpos( $html, $pattern ); - } - - // 3. Check if HTML includes the site's REST API link. + // 2. Check if HTML includes the site's REST API link. if ( has_action( 'wp_head', 'rest_output_link_wp_head' ) ) { // Try both HTTPS and HTTP since the URL depends on context. $pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( get_rest_url() ) ); // See rest_output_link_wp_head(). - return false !== strpos( $html, $pattern ); + return str_contains( $html, $pattern ); } // Otherwise the result cannot be determined.