Make WordPress Core

Opened 4 weeks ago

Last modified 6 days ago

#61623 accepted defect (bug)

Site Health PHP check shows inaccurate status

Reported by: swb1192's profile swb1192 Owned by: psykro's profile psykro
Milestone: 6.7 Priority: normal
Severity: normal Version: 6.5.5
Component: Site Health Keywords: has-patch good-first-bug
Focuses: administration, performance Cc:

Description

Site Health has a PHP check that returns a string related to the status of the PHP version. It should state if the PHP version is the latest version, an older (but supported) PHP version, or an older and insecure PHP version.

However, the current result states all supported versions are the "current version" of PHP.

To reproduce:

  • Set up a WordPress installation
  • Configure PHP as version 7.4 (supported but insecure and not the latest version)
  • Go to Tools > Site Health
  • View the Passed Tests

See:

"Your site is running the current version of PHP (7.4.30)"

Expected:

"Your site is running on an outdated version of PHP 7.4, which does not receive security updates. It should be updated."

Attachments (1)

Screenshot 2024-07-10 at 12.24.09 PM.png (112.7 KB) - added by swb1192 4 weeks ago.
screenshot running php 7.4

Download all attachments as: .zip

Change History (16)

@swb1192
4 weeks ago

screenshot running php 7.4

#2 @swb1192
4 weeks ago

  • Keywords close removed

@swissspidy Please re-open this ticket. The issue is not about whether PHP 7.4 is supported or not. The issue is that it says 7.4 is the current version of PHP. It may be recommended, but it's not the current version of PHP.

#3 @swissspidy
4 weeks ago

I didn't close the ticket. It is still open, the close just says closing is suggested.

#4 @swb1192
4 weeks ago

Got it, thank you. I can adjust the ticket copy if the intent or issue was unclear.

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


4 weeks ago
#5

  • Keywords has-patch added

Updates the Site Health PHP check message to correctly refer to the currently recommended version of PHP, not the current version of PHP

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

#6 @psykro
4 weeks ago

Looking at the code, the text needs to match any version of PHP that is equal to or greater than the recommended version.

So instead of

Your site is running the current version of PHP

It could say

Your site is running at least the minimum recommended version of PHP

This way, if the PHP version exceeds whatever the current recommended version is, the wording still makes sense.

EDIT: the Github bot was quicker than I was, the patch was meant to come after the comment.

Last edited 4 weeks ago by psykro (previous) (diff)

#7 @joemcgill
4 weeks ago

  • Focuses performance added
  • Milestone changed from Awaiting Review to Future Release

I think clarifying the wording for this health check makes sense. What doesn't make sense is that we are showing this success message also when wp_check_php_version() returns false due to an error validating the /core/serve-happy API response. We could consider changing that behavior as part of this ticket but shouldn't be blocking.

I'm also tagging for the performance focus given that this is labeled as a performance check.

#8 follow-up: @swb1192
3 weeks ago

@psykro Thanks for the patch. Perhaps better wording could be:

Your site is running a recommended version of PHP.

This ticket was mentioned in Slack in #core-performance by mukeshpanchal27. View the logs.


3 weeks ago

#10 @mukesh27
3 weeks ago

  • Keywords good-first-bug added

#11 @mukesh27
3 weeks ago

  • Milestone changed from Future Release to 6.7

Hi there!

This ticket was discussed on today's performance bug scrub.

The next step should be update site health copy text.

Move in to 6.7 for visibility.

Additional props: @swissspidy @joemcgill

#12 in reply to: ↑ 8 @psykro
3 weeks ago

  • Owner set to psykro
  • Status changed from new to accepted

Replying to swb1192:

@psykro Thanks for the patch. Perhaps better wording could be:

Your site is running a recommended version of PHP.

Yup, you're probably right, I'll update the patch.

#13 @SergeyBiryukov
6 days ago

In 58832:

Site Health: Improve the wording for PHP version check.

This aims to make the message more accurate by referring to the version of PHP currently recommended by WordPress, not the current version of PHP.

Follow-up to [44986], [46267], [47254].

Props swb1192, psykro, swissspidy, joemcgill, mukesh27, aristath.
See #61623.

@SergeyBiryukov commented on PR #7011:


6 days ago
#14

Thanks for the PR! Merged in r58832.

#15 @SergeyBiryukov
6 days ago

Thanks everyone! Keeping the ticket open for now to also address comment:7.

Note: See TracTickets for help on using tickets.