Make WordPress Core


Ignore:
Timestamp:
08/02/2024 10:36:27 PM (22 months ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r58827 r58843  
    88348834 * @since 5.2.0
    88358835 *
    8836  * @global string $wp_version The WordPress version string.
     8836 * @global string $_wp_tests_wp_version The WordPress version string. Used only in Core tests.
    88378837 *
    88388838 * @param string $required Minimum required WordPress version.
     
    88408840 */
    88418841function is_wp_version_compatible( $required ) {
    8842     global $wp_version;
     8842    if (
     8843        defined( 'WP_RUN_CORE_TESTS' )
     8844        && WP_RUN_CORE_TESTS
     8845        && isset( $GLOBALS['_wp_tests_wp_version'] )
     8846    ) {
     8847        $wp_version = $GLOBALS['_wp_tests_wp_version'];
     8848    } else {
     8849        $wp_version = wp_get_wp_version();
     8850    }
    88438851
    88448852    // Strip off any -alpha, -RC, -beta, -src suffixes.
Note: See TracChangeset for help on using the changeset viewer.