Repository navigation
Repair wp/5.5 branch Actions: Add a WP_ENV_PHP_VERSION environment variable - #85012
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Size Change: 0 B Total Size: 1.14 MB ℹ️ View Unchanged
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
f3b044c to
b02a1af
Compare
b02a1af to
9ec018b
Compare
Part of #82938.
What?
Adds a
WP_ENV_PHP_VERSIONenvironment variable that chooses the PHP version ofwp-env's WordPress and WP-CLI containers, and defaults it to7.4, the highest PHP version WordPress 5.5 supports. Inpackages/env/lib/build-docker-compose-config.js:wordpress,tests-wordpresswordpresswordpress:php${WP_ENV_PHP_VERSION:-7.4}cli,tests-cliwordpress:cliwordpress:cli-php${WP_ENV_PHP_VERSION:-7.4}Adds a test for the image strings, a README note next to the
WP_ENV_MARIADB_VERSIONone, and apackages/env/CHANGELOG.mdentry under New Features. Thephpunitservice is unchanged: it already usesLOCAL_PHP, which thePHPjob's matrix sets.Why?
The floating
wordpressimage now runs PHP 8.3, but WordPress 5.5 doesn't support PHP 8. On PHP 8, WordPress 5.5'sWP_Query::parse_query()makes every front-end request without a post ID a 404: it checks$qv['p'] < 0without casting, and PHP 8 compares''with0as strings, which is true. WordPress 5.6 casts the value to an integer first.That breaks every end-to-end test that loads the site editor's
front-pagedemo template: the front page is a 404, so Gutenberg resolvesindexinstead, andfront-pageand its header template part never load. 10 tests fail on this branch for that reason (experiments/multi-entity-editing.test.js5,multi-entity-saving.test.js4,template-part.test.js1).Defaulting to
7.4, rather than the images' default, means anyone running this branch'swp-envgets a PHP version WordPress 5.5 supports without setting anything. CI sets the variable explicitly in #85013.How?
This follows
WP_ENV_MARIADB_VERSION(#85008), and the variable name matches the one laterwp-envversions use.wp-env1.6.0 has nophpVersionoption to extend, so only the environment variable is added; Docker Compose fills it in when it reads the generateddocker-compose.yml. Both image families have aphp<version>/cli-php<version>tag for each PHP version, so one default covers both.Verified:
packages/env/test/build-docker-compose-config.js(14 tests).docker compose configon this branch's generated file resolveswordpress:php7.4/wordpress:cli-php7.4with the variable unset, andwordpress:php7.3/wordpress:cli-php7.3withWP_ENV_PHP_VERSION=7.3. All four tags exist on Docker Hub.7.4images passed every check, including all fourAdminjobs.Use of AI Tools
This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.