Make WordPress Core

Changeset 56141


Ignore:
Timestamp:
07/05/2023 05:39:55 PM (15 months ago)
Author:
johnbillion
Message:

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

This also removes the random compat library which is no longer necessary, and adjusts unit tests and CI workflows that no longer need to take PHP 5.6 into account.

Thank you for your service, PHP 5. Onwards!

Props SergeyBiryukov, mukesh27, dingo_d, audrasjb, jrf, costdev, azaozz, JavierCasares, hellofromTonya, samiamnot, spacedmonkey, masteradhoc, knutsp, garyjones, chanthaboune

Fixes #57345

Location:
trunk
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/phpunit-tests.yml

    r55717 r56141  
    3434  PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
    3535  LOCAL_PHP_MEMCACHED: ${{ false }}
    36   SLOW_TESTS: 'external-http,media,restapi'
    3736
    3837jobs:
     
    5756  # - Submit the test results to the WordPress.org host test results.
    5857  test-php:
    59     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
     58    name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    6059    runs-on: ${{ matrix.os }}
    6160    permissions:
     
    6665      fail-fast: false
    6766      matrix:
    68         php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
     67        php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
    6968        os: [ ubuntu-latest ]
    7069        memcached: [ false ]
    71         split_slow: [ false ]
    7270        multisite: [ false, true ]
    7371        include:
    74           # Additional "slow" jobs for PHP 5.6.
    75           - php: '5.6'
    76             os: ubuntu-latest
    77             memcached: false
    78             multisite: false
    79             split_slow: true
    80           - php: '5.6'
    81             os: ubuntu-latest
    82             memcached: false
    83             multisite: true
    84             split_slow: true
    8572          # Include jobs for PHP 7.4 with memcached.
    8673          - php: '7.4'
     
    175162        run: npm run env:install
    176163
    177       - name: Run slow PHPUnit tests
    178         if: ${{ matrix.split_slow }}
    179         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
    180 
    181       - name: Run PHPUnit tests for single site excluding slow tests
    182         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
    183         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
    184 
    185       - name: Run PHPUnit tests for Multisite excluding slow tests
    186         if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
    187         run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
    188 
    189164      - name: Run PHPUnit tests
    190         if: ${{ matrix.php >= '7.0' }}
    191165        run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}
    192166
    193167      - name: Run AJAX tests
    194         if: ${{ ! matrix.split_slow }}
    195168        run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
    196169
    197170      - name: Run ms-files tests as a multisite install
    198         if: ${{ matrix.multisite && ! matrix.split_slow }}
     171        if: ${{ matrix.multisite }}
    199172        run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
    200173
    201174      - name: Run external HTTP tests
    202         if: ${{ ! matrix.multisite && ! matrix.split_slow }}
     175        if: ${{ ! matrix.multisite }}
    203176        run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
    204177
    205178      # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    206179      - name: Run (Xdebug) tests
    207         if: ${{ ! matrix.split_slow }}
    208180        run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
    209181
  • trunk/composer.json

    r54355 r56141  
    1111    },
    1212    "require": {
    13         "php": ">=5.6"
     13        "php": ">=7.0"
    1414    },
    1515    "require-dev": {
  • trunk/phpcompat.xml.dist

    r53800 r56141  
    55    <rule ref="PHPCompatibilityWP"/>
    66
    7     <!-- WordPress Core currently supports PHP 5.6+. -->
    8     <config name="testVersion" value="5.6-"/>
     7    <!-- WordPress Core currently supports PHP 7.0+. -->
     8    <config name="testVersion" value="7.0-"/>
    99
    1010    <!-- Only scan PHP files. -->
  • trunk/src/readme.html

    r55665 r56141  
    5252<h2>System Requirements</h2>
    5353<ul>
    54     <li><a href="https://secure.php.net/">PHP</a> version <strong>5.6.20</strong> or greater.</li>
     54    <li><a href="https://secure.php.net/">PHP</a> version <strong>7.0</strong> or greater.</li>
    5555    <li><a href="https://www.mysql.com/">MySQL</a> version <strong>5.0</strong> or greater.</li>
    5656</ul>
  • trunk/src/wp-includes/compat.php

    r56017 r56141  
    334334endif;
    335335
    336 // random_int() was introduced in PHP 7.0.
    337 if ( ! function_exists( 'random_int' ) ) {
    338     require ABSPATH . WPINC . '/random_compat/random.php';
    339 }
    340336// sodium_crypto_box() was introduced in PHP 7.2.
    341337if ( ! function_exists( 'sodium_crypto_box' ) ) {
  • trunk/src/wp-includes/version.php

    r56130 r56141  
    3838 * @global string $required_php_version
    3939 */
    40 $required_php_version = '5.6.20';
     40$required_php_version = '7.0.0';
    4141
    4242/**
  • trunk/tests/phpunit/tests/admin/wpMediaListTable.php

    r56072 r56141  
    115115     *
    116116     * The warning that we should not see:
    117      * PHP 5.6 - 7.4: `Invalid argument supplied for foreach()`.
     117     * PHP <= 7.4: `Invalid argument supplied for foreach()`.
    118118     * PHP 8.0 and higher: `Warning: foreach() argument must be of type array|object, bool given`.
    119119     *
  • trunk/tests/phpunit/tests/date/dateI18n.php

    r55562 r56141  
    118118
    119119        $expected = '2022-08-01 00:00:00 -03 -03:00 America/Buenos_Aires';
    120         if ( PHP_VERSION_ID < 70000 ) {
    121             // PHP 5.6.
    122             $expected = '2022-08-01 00:00:00 ART -03:00 America/Buenos_Aires';
    123         }
    124120
    125121        $this->assertSame( $expected, date_i18n( 'Y-m-d H:i:s T P e', strtotime( '2022-08-01 00:00:00' ) ) );
  • trunk/tests/phpunit/tests/functions/wpListUtil.php

    r55423 r56141  
    211211     * @dataProvider data_wp_list_util_sort_arrays_of_arrays
    212212     * @dataProvider data_wp_list_util_sort_object_arrays
     213     * @dataProvider data_wp_list_util_sort_non_existent_orderby_fields
    213214     *
    214215     * @covers WP_List_Util::sort
     
    10031004
    10041005    /**
    1005      * Tests non-existent '$orderby' fields.
    1006      *
    1007      * In PHP < 7.0.0, the sorting behavior is different, which Core does not
    1008      * currently handle. Until this is fixed, or the minimum PHP version is
    1009      * raised to PHP 7.0.0+, these tests will be skipped on PHP < 7.0.0.
    1010      *
    1011      * @ticket 55300
    1012      *
    1013      * @dataProvider data_wp_list_util_sort_php_7_or_greater
    1014      *
    1015      * @covers WP_List_Util::sort
    1016      * @covers ::wp_list_sort
    1017      *
    1018      * @param array  $expected      The expected array.
    1019      * @param array  $target_array  The array to create a list from.
    1020      * @param array  $orderby       Optional. Either the field name to order by or an array
    1021      *                              of multiple orderby fields as `$orderby => $order`.
    1022      *                              Default empty array.
    1023      * @param string $order         Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
    1024      *                              is a string. Default 'ASC'.
    1025      * @param bool   $preserve_keys Optional. Whether to preserve keys. Default false.
    1026      */
    1027     public function test_wp_list_util_sort_php_7_or_greater( $expected, $target_array, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
    1028         if ( version_compare( PHP_VERSION, '7.0.0', '<' ) ) {
    1029             $this->markTestSkipped( 'This test can only run on PHP 7.0 or greater due to an unstable sort order.' );
    1030         }
    1031 
    1032         $util   = new WP_List_Util( $target_array );
    1033         $actual = $util->sort( $orderby, $order, $preserve_keys );
    1034 
    1035         $this->assertEqualSetsWithIndex(
    1036             $expected,
    1037             $actual,
    1038             'The sorted value did not match the expected value.'
    1039         );
    1040         $this->assertEqualSetsWithIndex(
    1041             $expected,
    1042             $util->get_output(),
    1043             '::get_output() did not return the expected value.'
    1044         );
    1045     }
    1046 
    1047     /**
    1048      * Data provider for test_wp_list_util_sort_php_7_or_greater().
     1006     * Data provider for test_wp_list_util_sort().
    10491007     *
    10501008     * @return array[]
    10511009     */
    1052     public function data_wp_list_util_sort_php_7_or_greater() {
     1010    public function data_wp_list_util_sort_non_existent_orderby_fields() {
    10531011        return array(
    10541012            'int[], int keys, $orderby a non-existent field, $order = ASC and $preserve_keys = false' => array(
Note: See TracChangeset for help on using the changeset viewer.