Make WordPress Core

Opened 2 years ago

Closed 22 months ago

Last modified 22 months ago

#62252 closed defect (bug) (fixed)

wp_is_https_supported uses deprecated function

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

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
2 years ago

cc @flixos90

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


2 years 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:


2 years ago
#3

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

#4 @flixos90
2 years ago

  • Milestone Awaiting Review → 6.8
  • Owner set to flixos90
  • Status new → 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:


2 years ago
#5

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

#6 @debarghyabanerjee
2 years ago

#62364 was marked as a duplicate.

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


2 years 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
2 years 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:


22 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
22 months ago

  • Resolution → fixed
  • Status reviewing → 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.