mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-30 15:31:04 +01:00
General: Use clean WordPress version in is_wp_version_compatible()
.
Update `is_wp_version_compatible()` to use `wp_get_wp_version()` introduced in [58813] to ensure the value of `$wp_version` has not been modified by a theme or plugin. Props costdev, mukesh27, Cybr, sergeybiryukov. Fixes #61781. Built from https://develop.svn.wordpress.org/trunk@58843 git-svn-id: http://core.svn.wordpress.org/trunk@58239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
99fc7666ac
commit
6a559b739b
@ -8833,13 +8833,21 @@ function wp_get_wp_version() {
|
|||||||
*
|
*
|
||||||
* @since 5.2.0
|
* @since 5.2.0
|
||||||
*
|
*
|
||||||
* @global string $wp_version The WordPress version string.
|
* @global string $_wp_tests_wp_version The WordPress version string. Used only in Core tests.
|
||||||
*
|
*
|
||||||
* @param string $required Minimum required WordPress version.
|
* @param string $required Minimum required WordPress version.
|
||||||
* @return bool True if required version is compatible or empty, false if not.
|
* @return bool True if required version is compatible or empty, false if not.
|
||||||
*/
|
*/
|
||||||
function is_wp_version_compatible( $required ) {
|
function is_wp_version_compatible( $required ) {
|
||||||
global $wp_version;
|
if (
|
||||||
|
defined( 'WP_RUN_CORE_TESTS' )
|
||||||
|
&& WP_RUN_CORE_TESTS
|
||||||
|
&& isset( $GLOBALS['_wp_tests_wp_version'] )
|
||||||
|
) {
|
||||||
|
$wp_version = $GLOBALS['_wp_tests_wp_version'];
|
||||||
|
} else {
|
||||||
|
$wp_version = wp_get_wp_version();
|
||||||
|
}
|
||||||
|
|
||||||
// Strip off any -alpha, -RC, -beta, -src suffixes.
|
// Strip off any -alpha, -RC, -beta, -src suffixes.
|
||||||
list( $version ) = explode( '-', $wp_version );
|
list( $version ) = explode( '-', $wp_version );
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.7-alpha-58842';
|
$wp_version = '6.7-alpha-58843';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user