From 163f9a9de89a17e15c43f1726d48a2cd8f131a5d Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Thu, 19 Nov 2026 10:37:40 +0530 Subject: [PATCH 1/4] feat(php): add PHP 8.6 to the supported PHP versions Allow `--php=8.6` for WordPress sites. The site runs the easyengine/php8.6 image with the tag from core's img-versions.json. The default and `latest` stay on 8.4. --- src/WordPress.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/WordPress.php b/src/WordPress.php index 6b12c27..cbdfc2e 100644 --- a/src/WordPress.php +++ b/src/WordPress.php @@ -139,7 +139,7 @@ public function __construct() { * : Set custom source directory for site inside htdocs. * * [--php=] - * : PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5 and latest. + * : PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6 and latest. * --- * default: 8.4 * options: @@ -153,7 +153,8 @@ public function __construct() { * - 8.2 * - 8.3 * - 8.4 - * - 8.5 + * - 8.5 + * - 8.6 * - latest * --- * @@ -385,7 +386,7 @@ public function create( $args, $assoc_args ) { $site_domains = ( 'subdom' === $this->site_data['app_sub_type'] ) ? [ $this->site_data['site_url'], '*.' . $this->site_data['site_url'] ] : [ $this->site_data['site_url'] ]; $this->site_data['alias_domains'] = implode( ',', array_merge( $site_domains, $alias_domains ) ); - $supported_php_versions = [ 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 'latest' ]; + $supported_php_versions = [ 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 'latest' ]; if ( ! in_array( $this->site_data['php_version'], $supported_php_versions ) ) { $old_version = $this->site_data['php_version']; $floor = (int) floor( $this->site_data['php_version'] ); From 8fd69affc664f8dca752e1525043e4d033e537ab Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Thu, 19 Nov 2026 11:38:23 +0530 Subject: [PATCH 2/4] feat(php): make PHP 8.5 the default for new WordPress sites New WordPress sites now default to PHP 8.5 instead of 8.4. `--php=latest` now runs the easyengine/php8.5 image, and create() now falls back to 8.5 for an 8.x version it doesn't support. PHP 8.6 stays opt-in with `--php=8.6`. Changes: the `--php` default and help in src/WordPress.php, the 8.x fallback in the same file, and the `latest` image in src/Site_WP_Docker.php. The Behat features that check the default or `latest` site now expect 8.5. The README's `--php` help now matches the command: default 8.5, with 8.6 listed. --- README.md | 20 ++++++++++++-------- features/COVERAGE.md | 2 +- features/php-version.feature | 8 ++++---- features/site.feature | 6 +++--- src/Site_WP_Docker.php | 2 +- src/WordPress.php | 4 ++-- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index fd5c96c..2698915 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,9 @@ ee site create --type=wp [--cache] [--vip] [--mu=] [--mu=] - PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5 and latest. + PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6 and latest. --- - default: 8.4 + default: 8.5 options: - 5.6 - 7.0 @@ -73,6 +73,7 @@ ee site create --type=wp [--cache] [--vip] [--mu=] [--mu= [--cache] [--vip] [--mu=] [--mu=] - PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5 and latest. + PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6 and latest. --- - default: 8.4 + default: 8.5 options: - 5.6 - 7.0 @@ -270,6 +271,7 @@ ee site info --type=wp [--cache] [--vip] [--mu=] [--mu= [--cache] [--vip] [--mu=] [--mu=] - PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5 and latest. + PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6 and latest. --- - default: 8.4 + default: 8.5 options: - 5.6 - 7.0 @@ -551,6 +553,7 @@ ee site reload --type=wp [--cache] [--vip] [--mu=] [--mu= [--cache] [--vip] [--mu=] [--mu=] - PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5 and latest. + PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6 and latest. --- - default: 8.4 + default: 8.5 options: - 5.6 - 7.0 @@ -695,6 +698,7 @@ ee site restart --type=wp [--cache] [--vip] [--mu=] [--mu=; 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1: `@slow` outlines; invalid (7.1, 9.9, foo): Unsupported PHP version…; loose matches (8, 8.10): not covered yet: versions are compared loosely, so `--php=8` passes validation (its outline comes back with the fix) | +| `--php` (13 options; 8.6 not covered until its image is published) | 8.5 default and update to 8.2: php-version: Default PHP version and update…; 8.3, 8.5, latest: Create a site on PHP ; 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1: `@slow` outlines; invalid (7.1, 9.9, foo): Unsupported PHP version…; loose matches (8, 8.10): not covered yet: versions are compared loosely, so `--php=8` passes validation (its outline comes back with the fix) | | `--dbname`, `--dbuser`, `--dbpass` | database: Custom database name…, Deleting the site drops its custom database and user; remote: external-db; collisions: database ×3 | | `--dbhost` (+ `:port`) | database: Remote database host requires credentials, Unreachable remote database rolls the site back; external-db: all scenarios | | `--dbprefix`, `--dbcharset`, `--dbcollate`, `--skip-check` | database: Custom database name, user, password, prefix, charset and collation… | diff --git a/features/php-version.feature b/features/php-version.feature index 0e04b05..fa2c048 100644 --- a/features/php-version.feature +++ b/features/php-version.feature @@ -4,8 +4,8 @@ Feature: PHP versions of WordPress sites (--php on create and update) Given a WordPress site 'bh-site-type-wp-php.test' exists Then the site 'bh-site-type-wp-php.test' info should contain: | field | value | - | php_version | 8.4 | - And the 'php' container of site 'bh-site-type-wp-php.test' should use image 'easyengine/php8.4:' + | php_version | 8.5 | + And the 'php' container of site 'bh-site-type-wp-php.test' should use image 'easyengine/php8.5:' When I run 'bin/ee site update bh-site-type-wp-php.test --php=8.2' Then the command should succeed And STDOUT should contain: @@ -19,7 +19,7 @@ Feature: PHP versions of WordPress sites (--php on create and update) | field | value | | php_version | 8.2 | And the 'php' container of site 'bh-site-type-wp-php.test' should use image 'easyengine/php8.2:' - And the directory '{SITES_DIR}/bh-site-type-wp-php.test/.backup/config/php-8.4' should exist + And the directory '{SITES_DIR}/bh-site-type-wp-php.test/.backup/config/php-8.5' should exist And the file '{SITES_DIR}/bh-site-type-wp-php.test/config/php/php/conf.d/custom.ini' should contain: """ sendmail_path = /usr/bin/msmtp -t @@ -69,7 +69,7 @@ Feature: PHP versions of WordPress sites (--php on create and update) | php | name | image | runtime | | 8.3 | 83 | php8.3 | 8.3. | | 8.5 | 85 | php8.5 | 8.5. | - | latest | latest | php8.4 | 8.4. | + | latest | latest | php8.5 | 8.5. | # These pull the older php images (not present on a fresh host) and need an older WordPress for PHP < 7.4. @slow diff --git a/features/site.feature b/features/site.feature index a1e285d..8ba5a1c 100644 --- a/features/site.feature +++ b/features/site.feature @@ -89,7 +89,7 @@ Feature: WordPress site lifecycle (create, info, list, enable/disable, restart/r | cache_mysql_query | 0 | | cache_app_object | 0 | | cache_host | | - | php_version | 8.4 | + | php_version | 8.5 | | db_host | global-db | | db_port | 3306 | | db_name | bh_site_type_wp_basic_test | @@ -141,7 +141,7 @@ Feature: WordPress site lifecycle (create, info, list, enable/disable, restart/r """ And the file '{SITES_DIR}/bh-site-type-wp-basic.test/docker-compose.yml' should contain: """ - image: easyengine/php8.4: + image: easyengine/php8.5: - VIRTUAL_HOST - VIRTUAL_PATH=/ - HSTS=off @@ -161,7 +161,7 @@ Feature: WordPress site lifecycle (create, info, list, enable/disable, restart/r And the 'mailhog' container of site 'bh-site-type-wp-basic.test' should not exist And the 'db' container of site 'bh-site-type-wp-basic.test' should not exist And the 'redis' container of site 'bh-site-type-wp-basic.test' should not exist - And the 'php' container of site 'bh-site-type-wp-basic.test' should use image 'easyengine/php8.4:' + And the 'php' container of site 'bh-site-type-wp-basic.test' should use image 'easyengine/php8.5:' And the 'php' container of site 'bh-site-type-wp-basic.test' should have restart policy 'always' And the 'php' container of site 'bh-site-type-wp-basic.test' should be connected to network 'ee-global-backend-network' And the 'nginx' container of site 'bh-site-type-wp-basic.test' should be connected to network 'ee-global-frontend-network' diff --git a/src/Site_WP_Docker.php b/src/Site_WP_Docker.php index b35b2a0..9efd236 100644 --- a/src/Site_WP_Docker.php +++ b/src/Site_WP_Docker.php @@ -67,7 +67,7 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) { } // PHP configuration. - $php_image_key = ( 'latest' === $filters['php_version'] ? 'easyengine/php8.4' : 'easyengine/php' . $filters['php_version'] ); + $php_image_key = ( 'latest' === $filters['php_version'] ? 'easyengine/php8.5' : 'easyengine/php' . $filters['php_version'] ); $php['service_name'] = [ 'name' => 'php' ]; $php['image'] = [ 'name' => $php_image_key . ':' . $img_versions[ $php_image_key ] ]; diff --git a/src/WordPress.php b/src/WordPress.php index cbdfc2e..422058e 100644 --- a/src/WordPress.php +++ b/src/WordPress.php @@ -141,7 +141,7 @@ public function __construct() { * [--php=] * : PHP version for site. Currently only supports PHP 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6 and latest. * --- - * default: 8.4 + * default: 8.5 * options: * - 5.6 * - 7.0 @@ -396,7 +396,7 @@ public function create( $args, $assoc_args ) { $this->site_data['php_version'] = 7.4; $old_version .= ' yet'; } elseif ( 8 === $floor ) { - $this->site_data['php_version'] = 8.4; + $this->site_data['php_version'] = 8.5; $old_version .= ' yet'; } else { EE::error( 'Unsupported PHP version: ' . $this->site_data['php_version'] ); From 9eabc6a5e65bce4d2f32d63643e0e60c65534d37 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Thu, 19 Nov 2026 23:38:12 +0530 Subject: [PATCH 3/4] refactor(php): read the default PHP version from one constant `WordPress::DEFAULT_PHP_VERSION` ('8.5') now drives the `latest` image in `Site_WP_Docker`, the 8.x fallback and create()'s own fallback when `--php` is missing, and `WordPress::SUPPORTED_PHP_VERSIONS` replaces the inline version list. This carries over the constant refactor of #238. The `--php` docblock keeps `default: 8.5`: EE's dispatcher injects it before create() runs, so it stays the effective default and `--help` keeps showing it. A docblock can't reference a constant, so a default bump changes both. Also fixes the indentation of the 8.x fallback branch. No behaviour change. --- src/Site_WP_Docker.php | 2 +- src/WordPress.php | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Site_WP_Docker.php b/src/Site_WP_Docker.php index 9efd236..05072ad 100644 --- a/src/Site_WP_Docker.php +++ b/src/Site_WP_Docker.php @@ -67,7 +67,7 @@ public function generate_docker_compose_yml( array $filters = [], $volumes ) { } // PHP configuration. - $php_image_key = ( 'latest' === $filters['php_version'] ? 'easyengine/php8.5' : 'easyengine/php' . $filters['php_version'] ); + $php_image_key = ( 'latest' === $filters['php_version'] ? 'easyengine/php' . WordPress::DEFAULT_PHP_VERSION : 'easyengine/php' . $filters['php_version'] ); $php['service_name'] = [ 'name' => 'php' ]; $php['image'] = [ 'name' => $php_image_key . ':' . $img_versions[ $php_image_key ] ]; diff --git a/src/WordPress.php b/src/WordPress.php index 422058e..e09a360 100644 --- a/src/WordPress.php +++ b/src/WordPress.php @@ -26,6 +26,16 @@ */ class WordPress extends EE_Site_Command { + /** + * Default PHP version for new sites, `latest` and the 8.x fallback. The create() docblock `default:` must match it. + */ + const DEFAULT_PHP_VERSION = '8.5'; + + /** + * Versions `--php` accepts. Keep in sync with the create() docblock options. + */ + const SUPPORTED_PHP_VERSIONS = [ '5.6', '7.0', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6', 'latest' ]; + /** * @var string $cache_type Type of caching being used. */ @@ -327,7 +337,7 @@ public function create( $args, $assoc_args ) { $this->cache_type = \EE\Utils\get_flag_value( $assoc_args, 'cache' ); $wildcard_flag = \EE\Utils\get_flag_value( $assoc_args, 'wildcard' ); $this->site_data['site_ssl_wildcard'] = 'subdom' === $this->site_data['app_sub_type'] || $wildcard_flag ? true : false; - $this->site_data['php_version'] = \EE\Utils\get_flag_value( $assoc_args, 'php' ); + $this->site_data['php_version'] = \EE\Utils\get_flag_value( $assoc_args, 'php', self::DEFAULT_PHP_VERSION ); $this->site_data['app_admin_url'] = \EE\Utils\get_flag_value( $assoc_args, 'title', $this->site_data['site_url'] ); $this->site_data['app_admin_username'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-user', \EE\Utils\random_name_generator() ); $this->site_data['app_admin_password'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-pass', '' ); @@ -386,8 +396,7 @@ public function create( $args, $assoc_args ) { $site_domains = ( 'subdom' === $this->site_data['app_sub_type'] ) ? [ $this->site_data['site_url'], '*.' . $this->site_data['site_url'] ] : [ $this->site_data['site_url'] ]; $this->site_data['alias_domains'] = implode( ',', array_merge( $site_domains, $alias_domains ) ); - $supported_php_versions = [ 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 'latest' ]; - if ( ! in_array( $this->site_data['php_version'], $supported_php_versions ) ) { + if ( ! in_array( $this->site_data['php_version'], self::SUPPORTED_PHP_VERSIONS ) ) { $old_version = $this->site_data['php_version']; $floor = (int) floor( $this->site_data['php_version'] ); if ( 5 === $floor ) { @@ -396,9 +405,9 @@ public function create( $args, $assoc_args ) { $this->site_data['php_version'] = 7.4; $old_version .= ' yet'; } elseif ( 8 === $floor ) { - $this->site_data['php_version'] = 8.5; - $old_version .= ' yet'; - } else { + $this->site_data['php_version'] = self::DEFAULT_PHP_VERSION; + $old_version .= ' yet'; + } else { EE::error( 'Unsupported PHP version: ' . $this->site_data['php_version'] ); } \EE::confirm( sprintf( 'EEv4 does not support PHP %s. Continue with PHP %s?', $old_version, $this->site_data['php_version'] ), $assoc_args ); From b0c5e551585cef74b750a09c436360de20bfa855 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Thu, 19 Nov 2026 23:44:13 +0530 Subject: [PATCH 4/4] fix(php): match --php against the supported versions as strings EE's synopsis check compares `--php` loosely with the options Spyc parses from the docblock (floats such as 8.5 next to strings such as '8.0'), so `8`, `8.10`, `08.5`, `8.60` or ` 8.5` pass it. create() compared loosely too and kept such values as they were, so the compose file asked for images like `easyengine/php8` or `easyengine/php8.10`, which have no tag in img-versions.json, and the create failed late. create() now trims the value, casts it to a string (the injected docblock default arrives as the float 8.5) and checks it strictly against `SUPPORTED_PHP_VERSIONS`. Surrounding whitespace is dropped; any other spelling that isn't listed gets the existing fallback prompt (`--php=8` asks to continue with 8.5, `--yes` takes it). A non-numeric value that gets through, such as a bare `--php` or `8.5abc` on PHP 7, is refused as unsupported instead of reaching floor(), which throws a TypeError on PHP 8. The fallback versions are strings as well, so the stored version is always a string such as '8.5'. Carries over the strict check from #238. --- features/COVERAGE.md | 2 +- src/WordPress.php | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/features/COVERAGE.md b/features/COVERAGE.md index 0d63008..7f24455 100644 --- a/features/COVERAGE.md +++ b/features/COVERAGE.md @@ -24,7 +24,7 @@ Legend: file names are under `features/`. Scenarios that assert the correct beha | `--local-db` | database: Create a site with a local database container, restart `--db`, disable/enable, delete | | `--with-local-redis` | cache: Create a site with cache on a local redis container; alone: not covered yet: `--with-local-redis` without `--cache` is silently ignored (its scenario comes back with the fix); restart policy: not covered yet: the local redis service has no restart policy (its scenario comes back with the fix) | | `--public-dir` | install-options: Serve WordPress from a public directory…; without value: not covered yet: a bare `--public-dir` makes the public dir `htdocs/1` (its scenario comes back with the fix) | -| `--php` (13 options; 8.6 not covered until its image is published) | 8.5 default and update to 8.2: php-version: Default PHP version and update…; 8.3, 8.5, latest: Create a site on PHP ; 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1: `@slow` outlines; invalid (7.1, 9.9, foo): Unsupported PHP version…; loose matches (8, 8.10): not covered yet: versions are compared loosely, so `--php=8` passes validation (its outline comes back with the fix) | +| `--php` (13 options; 8.6 not covered until its image is published) | 8.5 default and update to 8.2: php-version: Default PHP version and update…; 8.3, 8.5, latest: Create a site on PHP ; 5.6, 7.0, 7.2, 7.3, 7.4, 8.0, 8.1: `@slow` outlines; invalid (7.1, 9.9, foo): Unsupported PHP version…; loose matches (8, 8.10, 08.5, ' 8.5'): not covered: core's synopsis check compares loosely and lets them through, then create() compares as strings: surrounding whitespace is trimmed, the rest gets the fallback prompt (`--php=8` asks to continue with 8.5; `--yes` takes it) | | `--dbname`, `--dbuser`, `--dbpass` | database: Custom database name…, Deleting the site drops its custom database and user; remote: external-db; collisions: database ×3 | | `--dbhost` (+ `:port`) | database: Remote database host requires credentials, Unreachable remote database rolls the site back; external-db: all scenarios | | `--dbprefix`, `--dbcharset`, `--dbcollate`, `--skip-check` | database: Custom database name, user, password, prefix, charset and collation… | diff --git a/src/WordPress.php b/src/WordPress.php index e09a360..6685328 100644 --- a/src/WordPress.php +++ b/src/WordPress.php @@ -32,7 +32,7 @@ class WordPress extends EE_Site_Command { const DEFAULT_PHP_VERSION = '8.5'; /** - * Versions `--php` accepts. Keep in sync with the create() docblock options. + * Versions `--php` accepts, as strings for the strict check in create(). Keep in sync with the create() docblock options. */ const SUPPORTED_PHP_VERSIONS = [ '5.6', '7.0', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6', 'latest' ]; @@ -337,7 +337,8 @@ public function create( $args, $assoc_args ) { $this->cache_type = \EE\Utils\get_flag_value( $assoc_args, 'cache' ); $wildcard_flag = \EE\Utils\get_flag_value( $assoc_args, 'wildcard' ); $this->site_data['site_ssl_wildcard'] = 'subdom' === $this->site_data['app_sub_type'] || $wildcard_flag ? true : false; - $this->site_data['php_version'] = \EE\Utils\get_flag_value( $assoc_args, 'php', self::DEFAULT_PHP_VERSION ); + // The dispatcher passes the docblock default as a float, and its loose options check lets through values like '8' or ' 8.5'. + $this->site_data['php_version'] = trim( (string) \EE\Utils\get_flag_value( $assoc_args, 'php', self::DEFAULT_PHP_VERSION ) ); $this->site_data['app_admin_url'] = \EE\Utils\get_flag_value( $assoc_args, 'title', $this->site_data['site_url'] ); $this->site_data['app_admin_username'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-user', \EE\Utils\random_name_generator() ); $this->site_data['app_admin_password'] = \EE\Utils\get_flag_value( $assoc_args, 'admin-pass', '' ); @@ -396,13 +397,13 @@ public function create( $args, $assoc_args ) { $site_domains = ( 'subdom' === $this->site_data['app_sub_type'] ) ? [ $this->site_data['site_url'], '*.' . $this->site_data['site_url'] ] : [ $this->site_data['site_url'] ]; $this->site_data['alias_domains'] = implode( ',', array_merge( $site_domains, $alias_domains ) ); - if ( ! in_array( $this->site_data['php_version'], self::SUPPORTED_PHP_VERSIONS ) ) { + if ( ! in_array( $this->site_data['php_version'], self::SUPPORTED_PHP_VERSIONS, true ) ) { $old_version = $this->site_data['php_version']; - $floor = (int) floor( $this->site_data['php_version'] ); + $floor = is_numeric( $old_version ) ? (int) floor( $old_version ) : 0; if ( 5 === $floor ) { - $this->site_data['php_version'] = 5.6; + $this->site_data['php_version'] = '5.6'; } elseif ( 7 === $floor ) { - $this->site_data['php_version'] = 7.4; + $this->site_data['php_version'] = '7.4'; $old_version .= ' yet'; } elseif ( 8 === $floor ) { $this->site_data['php_version'] = self::DEFAULT_PHP_VERSION;