Make WordPress Core


Ignore:
Timestamp:
02/25/2024 10:15:11 PM (7 months ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-plugins-controller.php

    r57531 r57707  
    10221022        $this->assertSame( $network_only, $data['network_only'] );
    10231023        $this->assertSame( '5.6.0', $data['requires_php'] );
    1024         $this->assertSame( '5.4.0', $data['requires_wp'] );
     1024        $this->assertSame( '5.4', $data['requires_wp'] );
    10251025        $this->assertSame( 'test-plugin', $data['textdomain'] );
    10261026    }
     
    11501150 * Text Domain: test-plugin
    11511151 * Requires PHP: 5.6.0
    1152  * Requires at least: 5.4.0{$network}
     1152 * Requires at least: 5.4{$network}
    11531153 */
    11541154PHP;
Note: See TracChangeset for help on using the changeset viewer.