Repository navigation
Check the minimum PHP version from the WordPress checkout, before the build - #360
Merged
Merged
Conversation
…build prepare.php only rejected PHP older than 7.2, while WordPress has required PHP 7.4 since 7.0. With PHP 7.2 or 7.3 a run cloned and built WordPress and then failed in Composer with a dependency error. Read $required_php_version from src/wp-includes/version.php in the prepared checkout, the way update_core() reads the requirements of a new version, and run the check right after the clone, before npm install and the build.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Looks good to me. The PHP requirement is read from the cloned WordPress checkout and checked before the build, so unsupported PHP versions are caught early. I found no issues. |
kittenkamala
approved these changes
Oct 21, 2026
mindctrl
approved these changes
Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #359.
Problem
prepare.phponly rejects PHP older than 7.2, but WordPress has required PHP 7.4 since 7.0 (r61459). With PHP 7.2 or 7.3, a run gets past the check, clones and builds WordPress, and then fails in Composer with a dependency error. Details in #359.Fix
wpt_runner_get_required_php_version()loadssrc/wp-includes/version.phpfrom the prepared checkout inside a function and returns$required_php_version. WordPress reads the requirements of a new version the same way inupdate_core(). The check then follows WordPress when the minimum changes.npm installand the build, so an unsupported PHP version stops the run in seconds. The version lookup moved with it, unchanged.prepare.phpstops with an error that names the file.Verification
The version check block of
prepare.php, run on its own with the trunkversion.php(7.4):masterThe message reads: "WordPress requires PHP 7.4 or later, but the test environment runs PHP 7.3.33." With the 6.8 branch's
version.php(7.2.24), the check stops 7.2.23 and allows 7.2.24. Aversion.phpwith a double-quoted value is read the same way.Full
prepare.phpagainst trunk (8778884d3f):WPT_PHP_EXECUTABLEpointing to a script that reports 7.3.33:masterruns for 43 seconds (clone,npm install, build) and then fails in Composer. This branch stops after the clone, 7 seconds in, with the message above.wp-tests-config.phpfiles are identical.php -lpasses on PHP 7.4, 8.0 and 8.2, andphpcsis clean.Notes
prepare.php. The resolution keeps this check between the clone and Reduce the need for npm by installing built files from the WordPress mirror #246's asset step.AI assistance: Yes
Tool(s): Claude Code and Codex
Used for: Investigation, implementation, verification harness, and PR wording. I reviewed the reasoning and test results, and I take responsibility for the contribution.