Make WordPress Core

Opened 8 months ago

Closed 6 months ago

Last modified 6 months ago

#62252 closed defect (bug) (fixed)

wp_is_https_supported uses deprecated function

Reported by: peter8nss's profile peter8nss Owned by: flixos90's profile flixos90
Milestone: 6.8 Priority: normal
Severity: trivial Version: 6.4
Component: Site Health Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

Function wp_update_https_detection_errors is marked as deprecated but is still used by function wp_is_https_supported.

Think this is triggered from cron job wp_site_health_scheduled_check. I think it will only occur on the first run of this after a new installation if option https_detection_errors is not already set. After that, option https_detection_errors will be set, and the call to wp_update_https_detection_errors will be bypassed.

Change History (11)

#1 @swissspidy
8 months ago

cc @flixos90

This ticket was mentioned in PR #7598 on WordPress/wordpress-develop by @debarghyabanerjee.


8 months ago
#2

  • Keywords has-patch has-unit-tests added

Trac Ticket: Core-62252

## Summary

  • This pull request updates the wp_is_https_supported function to remove the use of the deprecated HTTPS detection mechanism. Instead, it now utilizes the wp_get_https_detection_errors function, which is the recommended approach for determining HTTPS support on the server and domain.

## Changes Made

  • Replaced the deprecated logic for checking HTTPS support with a call to wp_get_https_detection_errors().
  • Updated the return statement to check for errors returned by the new method. If there are any errors, the function will return false, indicating that HTTPS is not supported.

## Detailed Explanation

  • Reason for Change: The previous implementation of wp_is_https_supported relied on a deprecated method that may no longer function as expected in future releases. Using wp_get_https_detection_errors aligns with the current best practices for handling HTTPS detection in WordPress.

Functionality:

  • The updated wp_is_https_supported function checks for any HTTPS detection errors by calling wp_get_https_detection_errors().
  • It returns true if no errors are found, indicating that HTTPS is supported, and false if there are errors.

@debarghyabanerjee commented on PR #7598:


8 months ago
#3

Hi @peterwilsoncc , can you please take a look into this PR. Thanks.

#4 @flixos90
8 months ago

  • Milestone changed from Awaiting Review to 6.8
  • Owner set to flixos90
  • Status changed from new to reviewing

See #58494 for the original ticket that made the change.

The PR looks technically good to me, but we should address a few things in the documentation per https://github.com/WordPress/wordpress-develop/pull/7598/files#r1809152986.

@debarghyabanerjee commented on PR #7598:


8 months ago
#5

Hi @felixarntz , I have updated the Doc block comments, can you please take a look into it. Thanks.

#6 @debarghyabanerjee
7 months ago

#62364 was marked as a duplicate.

This ticket was mentioned in PR #7760 on WordPress/wordpress-develop by @geekofshire.


7 months ago
#7

Replaced the deprecated wp_update_https_detection_errors() function with wp_get_https_detection_errors() to align with the latest WordPress standards and avoid deprecation warnings.

Trac ticket: https://core.trac.wordpress.org/ticket/62252

#8 @desrosj
7 months ago

I've gone and pointed the PR associated with #62364 to this ticket so it also can be considered. Props to @sebastienserre for that one.

@flixos90 commented on PR #7760:


6 months ago
#9

@geekofshire Thank you for the pull request! It looks like this is a duplicate of #7598, which already implemented this change correctly, so I'm going to close this in favor of the other PR. I'll make sure to give you props on the WordPress Core commit though, thanks again!

#10 @flixos90
6 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 59517:

Site Health: Remove use of deprecated function from wp_is_https_supported().

Follow up to [56664].

Props peter8nss, debarghyabanerjee, sebastienserre, geekofshire, swissspidy, desrosj.
Fixes #62252.
See #58494.

Note: See TracTickets for help on using tickets.