Skip to content

Commit

Permalink
General: Increase the minimum supported version of PHP to 7.0.0.
Browse files Browse the repository at this point in the history
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


git-svn-id: https://develop.svn.wordpress.org/trunk@56141 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
johnbillion committed Jul 5, 2023
1 parent 28fa6d1 commit f7dbb24
Show file tree
Hide file tree
Showing 19 changed files with 13 additions and 1,386 deletions.
36 changes: 4 additions & 32 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ permissions: {}
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
LOCAL_PHP_MEMCACHED: ${{ false }}
SLOW_TESTS: 'external-http,media,restapi'

jobs:
# Runs the PHPUnit tests for WordPress.
Expand All @@ -56,7 +55,7 @@ jobs:
# - Checks out the WordPress Test reporter repository.
# - Submit the test results to the WordPress.org host test results.
test-php:
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
Expand All @@ -65,23 +64,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
os: [ ubuntu-latest ]
memcached: [ false ]
split_slow: [ false ]
multisite: [ false, true ]
include:
# Additional "slow" jobs for PHP 5.6.
- php: '5.6'
os: ubuntu-latest
memcached: false
multisite: false
split_slow: true
- php: '5.6'
os: ubuntu-latest
memcached: false
multisite: true
split_slow: true
# Include jobs for PHP 7.4 with memcached.
- php: '7.4'
os: ubuntu-latest
Expand Down Expand Up @@ -174,37 +161,22 @@ jobs:
- name: Install WordPress
run: npm run env:install

- name: Run slow PHPUnit tests
if: ${{ matrix.split_slow }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}

- name: Run PHPUnit tests for single site excluding slow tests
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
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

- name: Run PHPUnit tests for Multisite excluding slow tests
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
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

- name: Run PHPUnit tests
if: ${{ matrix.php >= '7.0' }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }}

- name: Run AJAX tests
if: ${{ ! matrix.split_slow }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax

- name: Run ms-files tests as a multisite install
if: ${{ matrix.multisite && ! matrix.split_slow }}
if: ${{ matrix.multisite }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files

- name: Run external HTTP tests
if: ${{ ! matrix.multisite && ! matrix.split_slow }}
if: ${{ ! matrix.multisite }}
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http

# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
- name: Run (Xdebug) tests
if: ${{ ! matrix.split_slow }}
run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__

- name: Ensure version-controlled files are not modified or deleted
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"issues": "https://core.trac.wordpress.org/"
},
"require": {
"php": ">=5.6"
"php": ">=7.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
Expand Down
4 changes: 2 additions & 2 deletions phpcompat.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

<rule ref="PHPCompatibilityWP"/>

<!-- WordPress Core currently supports PHP 5.6+. -->
<config name="testVersion" value="5.6-"/>
<!-- WordPress Core currently supports PHP 7.0+. -->
<config name="testVersion" value="7.0-"/>

<!-- Only scan PHP files. -->
<arg name="extensions" value="php"/>
Expand Down
2 changes: 1 addition & 1 deletion src/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h2>Migrating from other systems</h2>

<h2>System Requirements</h2>
<ul>
<li><a href="https://secure.php.net/">PHP</a> version <strong>5.6.20</strong> or greater.</li>
<li><a href="https://secure.php.net/">PHP</a> version <strong>7.0</strong> or greater.</li>
<li><a href="https://www.mysql.com/">MySQL</a> version <strong>5.0</strong> or greater.</li>
</ul>

Expand Down
4 changes: 0 additions & 4 deletions src/wp-includes/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,6 @@ function hash_equals( $known_string, $user_string ) {
}
endif;

// random_int() was introduced in PHP 7.0.
if ( ! function_exists( 'random_int' ) ) {
require ABSPATH . WPINC . '/random_compat/random.php';
}
// sodium_crypto_box() was introduced in PHP 7.2.
if ( ! function_exists( 'sodium_crypto_box' ) ) {
require ABSPATH . WPINC . '/sodium_compat/autoload.php';
Expand Down
195 changes: 0 additions & 195 deletions src/wp-includes/random_compat/byte_safe_strings.php

This file was deleted.

77 changes: 0 additions & 77 deletions src/wp-includes/random_compat/cast_to_int.php

This file was deleted.

Loading

0 comments on commit f7dbb24

Please sign in to comment.