File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313jobs :
1414 test :
1515 uses : wp-cli/.github/.github/workflows/reusable-testing.yml@main
16+
17+ minimum-php-guard :
18+ name : Minimum PHP guard - PHP ${{ matrix.php }}
19+ runs-on : ubuntu-22.04
20+ strategy :
21+ fail-fast : false
22+ matrix :
23+ php : ['5.6', '7.1']
24+ steps :
25+ - name : Check out source code
26+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27+ with :
28+ persist-credentials : false
29+
30+ - name : Set up PHP environment
31+ uses : shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
32+ with :
33+ php-version : ' ${{ matrix.php }}'
34+ coverage : none
35+
36+ - name : Check minimum PHP guard
37+ run : |
38+ if php php/boot-phar.php > stdout.txt 2> stderr.txt; then
39+ echo 'Expected boot-phar.php to reject unsupported PHP version.'
40+ exit 1
41+ fi
42+
43+ test ! -s stdout.txt
44+ printf 'Error: WP-CLI requires PHP 7.2.24 or newer. You are running version %s.\n' "$(php -r 'echo PHP_VERSION;')" > expected.txt
45+ diff -u expected.txt stderr.txt
Original file line number Diff line number Diff line change 11<?php
22
3+ // This file needs to parse without error in PHP 5.x.
4+
35if ( 'cli ' !== PHP_SAPI ) {
46 echo "WP-CLI only works correctly from the command line, using the 'cli' PHP SAPI. \n" ,
57 "You're currently executing the WP-CLI binary via the ' " . PHP_SAPI . "' PHP SAPI. \n" ,
911 die ( -1 );
1012}
1113
14+ if ( version_compare ( PHP_VERSION , '7.2.24 ' , '< ' ) ) {
15+ fwrite (
16+ STDERR ,
17+ sprintf ( "Error: WP-CLI requires PHP %s or newer. You are running version %s. \n" , '7.2.24 ' , PHP_VERSION )
18+ );
19+ die ( -1 );
20+ }
21+
1222// Store the path to the Phar early on for `Utils\phar-safe-path()` function.
1323define ( 'WP_CLI_PHAR_PATH ' , Phar ::running ( true ) );
1424
You can’t perform that action at this time.
0 commit comments