[wp-trac] [WordPress Trac] #59448: is_wp_version_compatible works unreliably

WordPress Trac noreply at wordpress.org
Sun Feb 25 22:15:26 UTC 2024


#59448: is_wp_version_compatible works unreliably
---------------------------------------------+----------------------------
 Reporter:  kkmuffme                         |       Owner:  peterwilsoncc
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  6.5
Component:  Upgrade/Install                  |     Version:  5.2
 Severity:  minor                            |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+----------------------------
Changes (by peterwilsoncc):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"57707" 57707]:
 {{{
 #!CommitTicketReference repository="" revision="57707"
 Upgrade/Install: Normalize major versions in `is_wp_version_compatible()`.

 Modify `is_wp_version_compatible()` to return the expected result for
 major WordPress versions formatted as either `x.x` or `x.x.0` (for example
 `6.5` and `6.5.0`).

 The WordPress project currently documents major version numbers in both
 formats leading to confusion for developers using the
 `is_wp_version_compatible()` function. As the PHP function
 `version_compare()` treats `x.x` and `x.x.0` as different version numbers
 this leads to unexpected results in the WP function.

 This change removes a trailing `.0` from major version numbers to account
 for the WordPress project using the two formats interchangeably.

 Props afragen, azaozz, costdev, joemcgill, jorbin, kkmuffme,
 sessioncookiemonster, swissspidy, wazeter.
 Fixes #59448.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59448#comment:36>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list