WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

Last modified 3 months ago

#46024 closed defect (bug) (fixed)

Make version_compare for Servehappy more robust

Reported by: afragen Owned by: flixos90
Milestone: 5.1 Priority: normal
Severity: normal Version: 5.1
Component: Site Health Keywords: has-patch servehappy dev-feedback needs-testing
Focuses: Cc:

Description

As discussed in #core-php https://wordpress.slack.com/archives/C60K3MP2Q/p1546880250090100 there's a potential problem with the current version_compare for testing compatibility with WordPress or PHP version numbers.

Using the current test version_compare( substr( phpversion(), 0, strlen( $requires ) ), $requires, '>=' ) if the current version is 5.1.10 and the required version is 5.1.2, the above will evaluate to false when it should be true.

Simplifying the test to version_compare( phpversion(), $requires, '>=' ) evaluates to true, as it should.

This test was added in r43436

Attachments (1)

46024.diff (2.5 KB) - added by afragen 8 months ago.
adjust version_compare logic

Download all attachments as: .zip

Change History (6)

@afragen
8 months ago

adjust version_compare logic

#1 @swissspidy
8 months ago

  • Milestone changed from Awaiting Review to 5.1

This ticket was mentioned in Slack in #core-php by afragen. View the logs.


8 months ago

#3 @flixos90
8 months ago

  • Owner set to flixos90
  • Status changed from new to reviewing

#4 @flixos90
8 months ago

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

In 44656:

Upgrade/Install: Make version_compare() calls for plugin required version checks more robust.

Props afragen.
Fixes #46024. See #43986.

#5 @spacedmonkey
3 months ago

  • Component changed from Upgrade/Install to Site Health
Note: See TracTickets for help on using tickets.