Repository navigation
feat(php): add PHP 8.6 and make 8.5 the default for new PHP sites - #126
Conversation
Allow `--php=8.6` for PHP 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.
New PHP 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/PHP.php, the 8.x fallback in the same file, and the `latest` image in src/Site_PHP_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.
|
No actionable comments were generated in the recent review. Walkthrough
Change: Feature Merge Risk:
|
`PHP::DEFAULT_PHP_VERSION` ('8.5') now drives the `latest` image in `Site_PHP_Docker`, the 8.x fallback and create()'s own fallback when `--php` is missing, and `PHP::SUPPORTED_PHP_VERSIONS` replaces the inline version list. This carries over the constant refactor of EasyEngine#113.
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.
No behaviour change.
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). 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 EasyEngine#113.
Summary
Adds PHP 8.6 to
ee site create --type=php, and moves the default PHP version for new PHP sites from 8.4 to 8.5, for EasyEngine v4.15.0.It also puts the default PHP version in one constant, so the next default bump is a small edit, and makes create() match
--phpas strings. This carries the constant refactor of #113 (supersedes #113).PHP 8.6 is opt-in with
--php=8.6. The default and--php=latestmove to 8.5:--phpdefault (new sites)--php=latestimageeasyengine/php8.4easyengine/php8.5--php=8.6easyengine/php8.6--php=8,8.10,08.5,8.60(EE's option check compares loosely and lets them through)easyengine/php8,easyengine/php8.10, … has no tag, the create fails late--php=' 8.5'Changes
feat(php): add PHP 8.6 to the supported PHP versions:8.6in the--phphelp, options and$supported_php_versionsofsrc/PHP.php. The site runs theeasyengine/php8.6image with the tag from core'simg-versions.json.feat(php): make PHP 8.5 the default for new PHP sites: the--phpdefault and help and the 8.x fallback insrc/PHP.php, and thelatestimage insrc/Site_PHP_Docker.php. The Behat features that check the default orlatestsite now expect 8.5 (features/site.feature,features/create.feature,features/lifecycle.feature,features/php-version.feature,features/COVERAGE.md). The README's--phphelp now matches the command: default 8.5, with 8.6 listed.refactor(php): read the default PHP version from one constant:PHP::DEFAULT_PHP_VERSION('8.5') drives thelatestimage insrc/Site_PHP_Docker.php, the 8.x fallback and create()'s fallback when--phpis missing, andPHP::SUPPORTED_PHP_VERSIONSreplaces the inline version list. The--phpdocblock keepsdefault: 8.5: EE's dispatcher injects it before create() runs, so it stays the effective default and--helpkeeps showing it (a docblock can't reference a constant).fix(php): match --php against the supported versions as strings: EE's synopsis check compares--phploosely with the options Spyc parses from the docblock (floats such as 8.5 next to strings such as'8.0'), so create() now trims the value, casts it to a string (the injected default arrives as the float 8.5) and checks it strictly againstSUPPORTED_PHP_VERSIONS. Values that only match numerically (8,8.10,08.5) get the existing fallback prompt instead of a broken image name, a non-numeric value that gets through (a bare--php, or8.5abcon PHP 7) is refused as unsupported instead of reachingfloor()(a TypeError on PHP 8), and the stored version is always a string such as'8.5'. The php type's create has no--yes, so the prompt reads stdin, as before.This only changes what new sites get. Existing sites keep their stored version. A site stored as
latestmoves to theeasyengine/php8.5image the next time its compose file is regenerated, and keeps the PHP config it already has. That's the same behaviour as in #110, which movedlatestand the fallback from 8.3 to 8.4.Why 8.5 and not 8.6
PHP 8.6.0 was released on 2026-11-19. Its image (EasyEngine/dockerfiles#385) builds memcached, redis and apcu from unreleased upstream commits, because their releases don't build on 8.6 yet, and it drops mcrypt and imap. 8.5 is the newest version with a complete extension set. 8.6 can become the default once the extensions have releases.
Dependencies
easyengine/php8.6image: feat(php): add the PHP 8.6 image dockerfiles#385 (tagv4.15.0).easyengine/php8.6inimg-versions.json(core PR). Without that pin,--php=8.6has no image tag.ee site update --php=8.6: feat(php): add PHP 8.6 to site update site-command#540 (addsphp86.zip).The Behat
php-version.featureoutline has no 8.6 row yet: it would fail until the image is published and core pins it.Bumping the default PHP version later
PHP::DEFAULT_PHP_VERSIONinsrc/PHP.php.default:of[--php=<php-version>]in the create() docblock.default:lines of the--phpblocks in README.md.latestversion (features/site.feature(default:in the help),features/create.feature,features/lifecycle.featureandfeatures/php-version.feature). They check the default site and alatestsite separately, so a bump that misses the constant or the docblock fails CI.Testing
PHPUnit, in my local test suite (not part of this PR), on PHP 7.4 and 8.5:
--phpinput by input, through EE's real synopsis check and through create(): every listed version andlatestare stored as that exact string and runeasyengine/php<v>with a tag from core'simg-versions.json(latestand an omitted--php→easyengine/php8.5);8.5is trimmed;8,8.10,08.5,8.60,8e0,7,5.60get the fallback prompt with the exact text, and answeringn(or no stdin) creates nothing; the php type has no--yes, so the prompt reads stdin as before; a bare--php,8.5abcand8.5.0(the last two pass EE's check only on PHP 7) are refused as unsupported;7.1,8.7,9.0,5.5,abcstay rejected by the synopsis check.default:equalsDEFAULT_PHP_VERSION, the docblock options and the "Currently only supports PHP …" sentence equalSUPPORTED_PHP_VERSIONS, every--phpblock in README.md matches both, every supported version has an image tag, andlatestruns the same image as a site created without--php. Bumping only the constant, or only the docblock default, makes these tests fail.develop, on both PHP versions.php -lis clean on PHP 7.4 and 8.5 for the changed files.Behat was not run locally. The updated features run in this repo's CI. They expect
easyengine/php8.5, which is already published.Summary by CodeRabbit
latestselects PHP 8.5.