From cf054c2ef8e8cd7ce3e744aecce667faef60d152 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Fri, 20 Nov 2026 06:38:03 +0530 Subject: [PATCH] fix(php): store the concrete version for --php=latest A site created with --php=latest was stored as `latest`, which follows the default PHP version: after a default bump, the next compose regeneration moves it to the new image while it keeps the PHP config of the old one (SC-60). create() now stores DEFAULT_PHP_VERSION (8.5) instead, so the compose file, custom.ini and the sites row all get the concrete version. --php=latest is still accepted, and rows that still say `latest` keep running the default image. Behat: the `latest` example of "Create a php site on every supported PHP version" expects php_version 8.5. --- features/COVERAGE.md | 2 +- features/php-version.feature | 30 +++++++++++++++--------------- src/PHP.php | 4 ++++ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/features/COVERAGE.md b/features/COVERAGE.md index ff4b983..f3278df 100644 --- a/features/COVERAGE.md +++ b/features/COVERAGE.md @@ -32,7 +32,7 @@ Scope: `ee site create --type=php` and everything php-specific (`src/PHP.php`, ` | `--force` (reset non-empty remote DB) | not covered: dead code today (remote credentials are never checked), needs a reachable remote MariaDB | | DB name / user collisions on rollback | database.feature: `--dbname`/`--dbuser` of another site refused, colliding default names refused by the volume check, a taken default name gets a `_2` suffix, each on its own sites (regression checks for EasyEngine/site-command#503 and EasyEngine/site-type-php#115) | | mysql CLI in the php container against the global and local db | not covered yet: the MariaDB client in php8.2+ images demands TLS, which the EasyEngine MariaDB doesn't offer (its 2 scenarios come back with the fix) | -| `--php=` every supported version + `latest` | php-version.feature outline (12 examples, `@slow`) | +| `--php=` every supported version + `latest` (stored as the default version, 8.5) | php-version.feature outline (12 examples, `@slow`) | | `--php` default 8.5 | create.feature "The site row holds the php defaults", "The compose file ..." | | `--php` invalid values | create.feature outline "An unsupported --php value is rejected" (4 examples) | | `--php` loosely matching values (`8`, `7`, `8.40`, `8.4.1`) | not covered: core's synopsis check compares loosely and lets them through (`8.4.1` only on PHP 7), then create() compares as strings and asks whether to continue with the fallback version (8.5, 7.4 or 5.6; `8.4.1` is refused as unsupported). The php type has no `--yes`, so the prompt reads stdin | diff --git a/features/php-version.feature b/features/php-version.feature index 275c374..7c6d36a 100644 --- a/features/php-version.feature +++ b/features/php-version.feature @@ -4,28 +4,28 @@ Feature: PHP versions of php sites (create --php, update --php) Scenario Outline: Create a php site on every supported PHP version When I run "bin/ee site create --type=php --php=" Then the command should succeed - And the site "" should have the field "php_version" set to "" + And the site "" should have the field "php_version" set to "" And the "php" service of site "" should use the pinned "" image And the php service of site "" should run PHP "" And a GET request to "http:///" should return 200 And the response should contain "Congratulations!" And the file "/opt/easyengine/sites//config/php/php/conf.d/custom.ini" should contain "" - # "latest" maps to the php8.5 image (Site_PHP_Docker); 8.6 is opt-in. + # "latest" is stored as the default version (8.5) and runs its image; 8.6 is opt-in. Examples: - | site | version | image | runs | sendmail | - | bh-site-type-php-40.test | 5.6 | easyengine/php5.6 | 5.6 | sendmail_path = /usr/sbin/sendmail -t -i -f no-reply@example.com | - | bh-site-type-php-41.test | 7.0 | easyengine/php7.0 | 7.0 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-42.test | 7.2 | easyengine/php7.2 | 7.2 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-43.test | 7.3 | easyengine/php7.3 | 7.3 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-44.test | 7.4 | easyengine/php7.4 | 7.4 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-45.test | 8.0 | easyengine/php8.0 | 8.0 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-46.test | 8.1 | easyengine/php8.1 | 8.1 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-47.test | 8.2 | easyengine/php8.2 | 8.2 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-48.test | 8.3 | easyengine/php8.3 | 8.3 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-49.test | 8.4 | easyengine/php8.4 | 8.4 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-50.test | 8.5 | easyengine/php8.5 | 8.5 | sendmail_path = /usr/bin/msmtp -t | - | bh-site-type-php-51.test | latest | easyengine/php8.5 | 8.5 | sendmail_path = /usr/bin/msmtp -t | + | site | version | stored | image | runs | sendmail | + | bh-site-type-php-40.test | 5.6 | 5.6 | easyengine/php5.6 | 5.6 | sendmail_path = /usr/sbin/sendmail -t -i -f no-reply@example.com | + | bh-site-type-php-41.test | 7.0 | 7.0 | easyengine/php7.0 | 7.0 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-42.test | 7.2 | 7.2 | easyengine/php7.2 | 7.2 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-43.test | 7.3 | 7.3 | easyengine/php7.3 | 7.3 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-44.test | 7.4 | 7.4 | easyengine/php7.4 | 7.4 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-45.test | 8.0 | 8.0 | easyengine/php8.0 | 8.0 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-46.test | 8.1 | 8.1 | easyengine/php8.1 | 8.1 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-47.test | 8.2 | 8.2 | easyengine/php8.2 | 8.2 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-48.test | 8.3 | 8.3 | easyengine/php8.3 | 8.3 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-49.test | 8.4 | 8.4 | easyengine/php8.4 | 8.4 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-50.test | 8.5 | 8.5 | easyengine/php8.5 | 8.5 | sendmail_path = /usr/bin/msmtp -t | + | bh-site-type-php-51.test | latest | 8.5 | easyengine/php8.5 | 8.5 | sendmail_path = /usr/bin/msmtp -t | Scenario: Update the PHP version of a php site and keep custom php settings Given a php site "bh-site-type-php-52.test" exists diff --git a/src/PHP.php b/src/PHP.php index 61e13c9..1a71e2d 100644 --- a/src/PHP.php +++ b/src/PHP.php @@ -261,6 +261,10 @@ public function create( $args, $assoc_args ) { } \EE::confirm( sprintf( 'EEv4 does not support PHP %s. Continue with PHP %s?', $old_version, $this->site_data['php_version'] ) ); } + // Stored as the concrete version: a stored `latest` would move to a newer image on a later default bump and keep the old PHP config. + if ( 'latest' === $this->site_data['php_version'] ) { + $this->site_data['php_version'] = self::DEFAULT_PHP_VERSION; + } \EE\Site\Utils\check_site_name_conflicts( $this->site_data['site_url'], $this->site_data['site_fs_path'] );