Make WordPress Core

Changeset 61459


Ignore:
Timestamp:
01/09/2026 11:45:46 AM (5 weeks ago)
Author:
johnbillion
Message:

General: Increase the minimum supported version of PHP to 7.4.

Props justlevine, masteradhoc, samiamnot, matt, bradshawtm, 4thhubbard, desrosj, jorbin, westonruter, peterwilsoncc, johnbillion

Fixes #62622

Location:
trunk
Files:
5 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/install-testing.yml

    r61245 r61459  
    22#
    33# This workflow is not meant to test wordpress-develop checkouts, but rather tagged versions officially available on WordPress.org.
     4#
     5# This workflow is triggered for all WordPress versions that are currently receiving security updates. It therefore needs to
     6# retain support for older PHP and database versions.
    47name: Installation Tests
    58
  • trunk/.github/workflows/local-docker-environment.yml

    r61245 r61459  
    107107          - db-version: '9.3'
    108108          - db-version: '9.4'
    109           # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
    110           - php: '7.2'
    111             db-version: '9.5'
    112           - php: '7.3'
    113             db-version: '9.5'
    114109          # No PHP 8.5 + Memcached support yet.
    115110          - php: '8.5'
  • trunk/.github/workflows/phpunit-tests.yml

    r61245 r61459  
    7373      matrix:
    7474        os: [ ubuntu-24.04 ]
    75         php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
     75        php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
    7676        db-type: [ 'mysql' ]
    7777        db-version: [ '5.7', '8.0', '8.4' ]
     
    150150      matrix:
    151151        os: [ ubuntu-24.04 ]
    152         php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
     152        php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
    153153        db-type: [ 'mariadb' ]
    154154        db-version: [ '5.5', '10.3', '10.5', '10.6', '10.11', '11.4', '11.8' ]
     
    202202      matrix:
    203203        os: [ ubuntu-24.04 ]
    204         php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
     204        php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
    205205        db-type: [ 'mysql', 'mariadb' ]
    206206        db-version: [ '9.5', '12.0' ]
     
    210210
    211211        exclude:
    212           # MySQL 9.0+ will not work on PHP <= 7.3 because mysql_native_password was removed. See https://core.trac.wordpress.org/ticket/61218.
    213           - php: '7.2'
    214             db-version: '9.5'
    215           - php: '7.3'
    216             db-version: '9.5'
    217212          # Exclude version combinations that don't exist.
    218213          - db-type: 'mariadb'
     
    249244      fail-fast: false
    250245      matrix:
    251         php: [ '7.2', '7.4', '8.0', '8.4' ]
     246        php: [ '7.4', '8.0', '8.4' ]
    252247        db-type: [ 'mysql' ]
    253248        db-version: [ '8.4' ]
     
    278273      fail-fast: false
    279274      matrix:
    280         php: [ '7.2', '8.4' ]
     275        php: [ '7.4', '8.4' ]
    281276        db-version: [ '8.4', '11.8' ]
    282277        db-type: [ 'mysql', 'mariadb' ]
  • trunk/.github/workflows/reusable-upgrade-testing.yml

    r61209 r61459  
    7676          -e MYSQL_ROOT_PASSWORD="root"
    7777          -e MYSQL_DATABASE="test_db"
    78           --entrypoint sh ${{ inputs.db-type }}:${{ inputs.db-version }}
    79           -c "exec docker-entrypoint.sh mysqld${{ inputs.db-type == 'mysql' && contains( fromJSON('["7.2", "7.3"]'), inputs.php ) && ' --default-authentication-plugin=mysql_native_password' || '' }}"
    8078
    8179    steps:
  • trunk/.github/workflows/upgrade-develop-testing.yml

    r61222 r61459  
    6464      matrix:
    6565        os: [ 'ubuntu-24.04' ]
    66         php: [ '7.2', '8.4' ]
     66        php: [ '7.4', '8.4' ]
    6767        db-type: [ 'mysql' ]
    6868        db-version: [ '5.7', '8.4' ]
    69         # WordPress 4.9 is the oldest version that supports PHP 7.2.
    70         wp: [ '4.9', '6.7', '6.8', '6.9-RC1' ]
     69        # WordPress 5.3 is the oldest version that supports PHP 7.4.
     70        wp: [ '5.3', '6.7', '6.8', '6.9-RC1' ]
    7171        multisite: [ false, true ]
    72 
    73         exclude:
    74           # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
    75           - php: '7.2'
    76             db-version: '8.4'
    77           # WordPress 4.9 does not support PHP 8.4.
    78           - php: '8.4'
    79             wp: '4.9'
    8072    with:
    8173      os: ${{ matrix.os }}
     
    9991      matrix:
    10092        os: [ 'ubuntu-24.04' ]
    101         php: [ '7.2', '8.4' ]
     93        php: [ '7.4', '8.4' ]
    10294        db-type: [ 'mysql' ]
    10395        db-version: [ '8.4' ]
    104         # WordPress 4.9 is the oldest version that supports PHP 7.2.
    10596        wp: [ '6.7', '6.8' ]
    10697        multisite: [ false, true ]
    107 
    108         exclude:
    109           # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
    110           - php: '7.2'
    111             db-version: '8.4'
    11298    with:
    11399      os: ${{ matrix.os }}
  • trunk/.github/workflows/upgrade-testing.yml

    r61245 r61459  
    6969      matrix:
    7070        os: [ 'ubuntu-24.04' ]
    71         php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
     71        php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
    7272        db-type: [ 'mysql' ]
    7373        db-version: [ '5.7', '8.0', '8.4', '9.5' ]
    7474        wp: [ '6.7', '6.8' ]
    7575        multisite: [ false, true ]
    76 
    77         exclude:
    78           # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
    79           - php: '7.2'
    80             db-version: '8.4'
    81           - php: '7.3'
    82             db-version: '8.4'
    83           # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
    84           - php: '7.2'
    85             db-version: '9.5'
    86           - php: '7.3'
    87             db-version: '9.5'
    8876    with:
    8977      os: ${{ matrix.os }}
     
    10694      matrix:
    10795        os: [ 'ubuntu-24.04' ]
    108         php: [ '7.2', '7.4', '8.0', '8.4' ]
     96        php: [ '7.4', '8.0', '8.4' ]
    10997        db-type: [ 'mysql' ]
    11098        db-version: [ '5.7', '8.4' ]
    11199        wp: [ '6.0', '6.3', '6.4', '6.5' ]
    112100        multisite: [ false, true ]
    113 
    114         exclude:
    115           # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
    116           - php: '7.2'
    117             db-version: '8.4'
    118     with:
    119       os: ${{ matrix.os }}
    120       php: ${{ matrix.php }}
    121       db-type: ${{ matrix.db-type }}
    122       db-version: ${{ matrix.db-version }}
    123       wp: ${{ matrix.wp }}
    124       new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
    125       multisite: ${{ matrix.multisite }}
    126 
    127   # Tests 5.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 7.
     101    with:
     102      os: ${{ matrix.os }}
     103      php: ${{ matrix.php }}
     104      db-type: ${{ matrix.db-type }}
     105      db-version: ${{ matrix.db-version }}
     106      wp: ${{ matrix.wp }}
     107      new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
     108      multisite: ${{ matrix.multisite }}
     109
     110  # Tests 5.x releases where the WordPress database version changed on the only supported version of PHP 7.
    128111  upgrade-tests-wp-5x-php-7x-mysql:
    129112    name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
     
    136119      matrix:
    137120        os: [ 'ubuntu-24.04' ]
    138         php: [ '7.2', '7.4' ]
     121        php: [ '7.4' ]
    139122        db-type: [ 'mysql' ]
    140123        db-version: [ '5.7', '8.4' ]
    141124        wp: [ '5.0', '5.1', '5.3', '5.4', '5.5', '5.6', '5.9' ]
    142125        multisite: [ false, true ]
    143 
    144         exclude:
    145           # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
    146           - php: '7.2'
    147             db-version: '8.4'
    148126    with:
    149127      os: ${{ matrix.os }}
     
    200178      matrix:
    201179        os: [ 'ubuntu-24.04' ]
    202         php: [ '7.2', '7.3', '7.4' ]
     180        php: [ '7.4' ]
    203181        db-type: [ 'mysql' ]
    204182        db-version: [ '5.7', '8.0', '8.4', '9.5' ]
    205183        wp: [ '4.7' ]
    206184        multisite: [ false, true ]
    207 
    208         exclude:
    209           # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
    210           - php: '7.2'
    211             db-version: '8.4'
    212           - php: '7.3'
    213             db-version: '8.4'
    214           # MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
    215           - php: '7.2'
    216             db-version: '9.5'
    217           - php: '7.3'
    218             db-version: '9.5'
    219185    with:
    220186      os: ${{ matrix.os }}
  • trunk/.version-support-php.json

    r61222 r61459  
    11{
    22    "7-0": [
    3         "7.2",
    4         "7.3",
    53        "7.4",
    64        "8.0",
  • trunk/composer.json

    r61306 r61459  
    1414        "ext-hash": "*",
    1515        "ext-json": "*",
    16         "php": ">=7.2.24"
     16        "php": ">=7.4"
    1717    },
    1818    "suggest": {
  • trunk/docker-compose.yml

    r60926 r61459  
    8080      - mysql:/var/lib/mysql
    8181
    82     # For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
    83     command: ${LOCAL_DB_AUTH_OPTION-}
    84 
    8582    healthcheck:
    8683      test: [
  • trunk/phpcompat.xml.dist

    r61174 r61459  
    6767    <rule ref="PHPCompatibilityWP"/>
    6868
    69     <!-- WordPress Core currently supports PHP 7.2+. -->
    70     <config name="testVersion" value="7.2-"/>
     69    <!-- WordPress Core currently supports PHP 7.4+. -->
     70    <config name="testVersion" value="7.4-"/>
    7171
    7272    <!--
  • trunk/src/readme.html

    r61440 r61459  
    5353<h2>System Requirements</h2>
    5454<ul>
    55     <li><a href="https://www.php.net/">PHP</a> version <strong>7.2.24</strong> or greater.</li>
     55    <li><a href="https://www.php.net/">PHP</a> version <strong>7.4</strong> or greater.</li>
    5656    <li><a href="https://www.mysql.com/">MySQL</a> version <strong>5.5.5</strong> or greater.</li>
    5757</ul>
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r61444 r61459  
    966966                'required' => false,
    967967            ),
     968            // Sodium was introduced in PHP 7.2, but the extension may not be enabled.
    968969            'libsodium' => array(
    969970                'constant'            => 'SODIUM_LIBRARY_VERSION',
  • trunk/src/wp-admin/includes/misc.php

    r61440 r61459  
    16221622    $response['is_lower_than_future_minimum'] = false;
    16231623
    1624     // The minimum supported PHP version will be updated to 7.4 in the future. Check if the current version is lower.
    1625     if ( version_compare( $version, '7.4', '<' ) ) {
     1624    // The minimum supported PHP version will be updated to at least 8.0 in the future. Check if the current version is lower.
     1625    if ( version_compare( $version, '8.0', '<' ) ) {
    16261626        $response['is_lower_than_future_minimum'] = true;
    16271627
  • trunk/src/wp-includes/compat.php

    r61328 r61459  
    297297endif;
    298298
    299 // sodium_crypto_box() was introduced in PHP 7.2.
     299// sodium_crypto_box() was introduced with Sodium in PHP 7.2, but the extension may not be enabled.
    300300if ( ! function_exists( 'sodium_crypto_box' ) ) {
    301301    require ABSPATH . WPINC . '/sodium_compat/autoload.php';
    302 }
    303 
    304 if ( ! function_exists( 'is_countable' ) ) {
    305     /**
    306      * Polyfill for is_countable() function added in PHP 7.3.
    307      *
    308      * Verify that the content of a variable is an array or an object
    309      * implementing the Countable interface.
    310      *
    311      * @since 4.9.6
    312      *
    313      * @param mixed $value The value to check.
    314      * @return bool True if `$value` is countable, false otherwise.
    315      */
    316     function is_countable( $value ) {
    317         return ( is_array( $value )
    318             || $value instanceof Countable
    319             || $value instanceof SimpleXMLElement
    320             || $value instanceof ResourceBundle
    321         );
    322     }
    323 }
    324 
    325 if ( ! function_exists( 'array_key_first' ) ) {
    326     /**
    327      * Polyfill for array_key_first() function added in PHP 7.3.
    328      *
    329      * Get the first key of the given array without affecting
    330      * the internal array pointer.
    331      *
    332      * @since 5.9.0
    333      *
    334      * @param array $array An array.
    335      * @return string|int|null The first key of array if the array
    336      *                         is not empty; `null` otherwise.
    337      */
    338     function array_key_first( array $array ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
    339         if ( empty( $array ) ) {
    340             return null;
    341         }
    342 
    343         foreach ( $array as $key => $value ) {
    344             return $key;
    345         }
    346     }
    347 }
    348 
    349 if ( ! function_exists( 'array_key_last' ) ) {
    350     /**
    351      * Polyfill for `array_key_last()` function added in PHP 7.3.
    352      *
    353      * Get the last key of the given array without affecting the
    354      * internal array pointer.
    355      *
    356      * @since 5.9.0
    357      *
    358      * @param array $array An array.
    359      * @return string|int|null The last key of array if the array
    360      *.                        is not empty; `null` otherwise.
    361      */
    362     function array_key_last( array $array ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
    363         if ( empty( $array ) ) {
    364             return null;
    365         }
    366 
    367         end( $array );
    368 
    369         return key( $array );
    370     }
    371302}
    372303
  • trunk/src/wp-includes/pluggable.php

    r61457 r61459  
    27782778         * - `PASSWORD_DEFAULT`
    27792779         *
    2780          * The values of the algorithm constants are strings in PHP 7.4+ and integers in PHP 7.3 and earlier.
    2781          *
    27822780         * @since 6.8.0
    2783          *
    2784          * @param string|int $algorithm The hashing algorithm. Default is the value of the `PASSWORD_BCRYPT` constant.
     2781         * @since 7.0.0 The `$algorithm` parameter is now always a string.
     2782         *
     2783         * @param string $algorithm The hashing algorithm. Default is the value of the `PASSWORD_BCRYPT` constant.
    27852784         */
    27862785        $algorithm = apply_filters( 'wp_hash_password_algorithm', PASSWORD_BCRYPT );
     
    27922791         * filter. You must ensure that the options are appropriate for the algorithm in use.
    27932792         *
    2794          * The values of the algorithm constants are strings in PHP 7.4+ and integers in PHP 7.3 and earlier.
    2795          *
    27962793         * @since 6.8.0
    2797          *
    2798          * @param array      $options   Array of options to pass to the password hashing functions.
    2799          *                              By default this is an empty array which means the default
    2800          *                              options will be used.
    2801          * @param string|int $algorithm The hashing algorithm in use.
     2794         * @since 7.0.0 The `$algorithm` parameter is now always a string.
     2795         *
     2796         * @param array  $options   Array of options to pass to the password hashing functions.
     2797         *                          By default this is an empty array which means the default
     2798         *                          options will be used.
     2799         * @param string $algorithm The hashing algorithm in use.
    28022800         */
    28032801        $options = apply_filters( 'wp_hash_password_options', array(), $algorithm );
  • trunk/src/wp-includes/version.php

    r61222 r61459  
    3838 * @global string $required_php_version
    3939 */
    40 $required_php_version = '7.2.24';
     40$required_php_version = '7.4';
    4141
    4242/**
  • trunk/tests/phpunit/includes/abstract-testcase.php

    r61424 r61459  
    143143     * Sets the bcrypt cost option for password hashing during tests.
    144144     *
    145      * @param array      $options   The options for password hashing.
    146      * @param string|int $algorithm The algorithm to use for hashing. This is a string in PHP 7.4+ and an integer in PHP 7.3 and earlier.
    147      */
    148     public function wp_hash_password_options( array $options, $algorithm ): array {
     145     * @param array  $options   The options for password hashing.
     146     * @param string $algorithm The algorithm to use for hashing.
     147     */
     148    public function wp_hash_password_options( array $options, string $algorithm ): array {
    149149        if ( PASSWORD_BCRYPT === $algorithm ) {
    150150            $options['cost'] = 5;
     
    15961596        }
    15971597
    1598         /*
    1599          * Compatibility check for PHP < 7.4, where array_merge() expects at least one array.
    1600          * See: https://3v4l.org/BIQMA
    1601          */
    1602         if ( array() === $matched_dirs ) {
    1603             return array();
    1604         }
    1605 
    16061598        return array_merge( ...$matched_dirs );
    16071599    }
  • trunk/tests/phpunit/tests/admin/wpMediaListTable.php

    r60729 r61459  
    123123     *
    124124     * The warning that we should not see:
    125      * PHP <= 7.4: `Invalid argument supplied for foreach()`.
     125     * PHP 7.4: `Invalid argument supplied for foreach()`.
    126126     * PHP 8.0 and higher: `Warning: foreach() argument must be of type array|object, bool given`.
    127127     *
  • trunk/tools/local-env/scripts/install.js

    r60735 r61459  
    99
    1010dotenvExpand.expand( dotenv.config() );
    11 
    12 // Determine if a non-default database authentication plugin needs to be used.
    13 local_env_utils.determine_auth_option();
    1411
    1512// Create wp-config.php.
  • trunk/tools/local-env/scripts/start.js

    r60308 r61459  
    1515
    1616const composeFiles = local_env_utils.get_compose_files();
    17 
    18 // Determine if a non-default database authentication plugin needs to be used.
    19 local_env_utils.determine_auth_option();
    2017
    2118// Check if the Docker service is running.
  • trunk/tools/local-env/scripts/utils.js

    r60308 r61459  
    1111     * By default, only the standard docker-compose.yml file will be used.
    1212     *
    13      * When PHP 7.2 or 7.3 is used in combination with MySQL 8.4, an override file will also be returned to ensure
    14      * that the mysql_native_password plugin authentication plugin is on and available for use.
    15      *
    1613     * @return {string[]} Compose files.
    1714     */
     
    2320        }
    2421
    25         if ( process.env.LOCAL_DB_TYPE !== 'mysql' ) {
    26             return composeFiles;
    27         }
    28 
    29         if ( process.env.LOCAL_PHP !== '7.2-fpm' && process.env.LOCAL_PHP !== '7.3-fpm' ) {
    30             return composeFiles;
    31         }
    32 
    33         // PHP 7.2/7.3 in combination with MySQL 8.4 requires additional configuration to function properly.
    34         if ( process.env.LOCAL_DB_VERSION === '8.4' ) {
    35             composeFiles.push( 'tools/local-env/old-php-mysql-84.override.yml' );
    36         }
    37 
    3822        return composeFiles;
    39     },
    40 
    41     /**
    42      * Determines the option to pass for proper authentication plugin configuration given the specified PHP version,
    43      * database type, and database version.
    44      */
    45     determine_auth_option: function() {
    46         if ( process.env.LOCAL_DB_TYPE !== 'mysql' ) {
    47             return;
    48         }
    49 
    50         if ( process.env.LOCAL_PHP !== '7.2-fpm' && process.env.LOCAL_PHP !== '7.3-fpm' ) {
    51             return;
    52         }
    53 
    54         // MySQL 8.4 removed --default-authentication-plugin in favor of --authentication-policy.
    55         if ( process.env.LOCAL_DB_VERSION === '8.4' ) {
    56             process.env.LOCAL_DB_AUTH_OPTION = '--authentication-policy=mysql_native_password';
    57         } else {
    58             process.env.LOCAL_DB_AUTH_OPTION = '--default-authentication-plugin=mysql_native_password';
    59         }
    6023    }
    6124};
Note: See TracChangeset for help on using the changeset viewer.