Skip to content

fix(php): store the concrete version for --php=latest - #127

Merged
mrrobot47 merged 1 commit into
EasyEngine:developfrom
mrrobot47:fix/store-concrete-latest-php
Nov 20, 2026
Merged

mrrobot47 merged 1 commit into
EasyEngine:developfrom
mrrobot47:fix/store-concrete-latest-php

Conversation

@mrrobot47

@mrrobot47 mrrobot47 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What

ee site create --type=php --php=latest now stores the concrete default version (PHP::DEFAULT_PHP_VERSION, 8.5 today) in the sites table instead of latest. --php=latest is still accepted as an input.

Why

A stored latest follows the default PHP version. When the default moves (8.4 → 8.5 in v4.15.0), the next compose regeneration (ee site refresh, any update that rewrites docker-compose.yml) moves such a site to the new image, while its config/php was generated for the old one: startup warnings for extensions the new image doesn't have or builds in (SC-60). EasyEngine/site-command#541 pins the existing latest rows once; without this change, every new latest site would hit the same problem at the next default bump.

Change

create() resolves latest to self::DEFAULT_PHP_VERSION right after the supported-version check, so everything downstream sees the concrete value: the php.ini-56 choice, the compose filter, and the sites row. The latest → easyengine/php<default> mapping in Site_PHP_Docker.php stays for rows that still say latest.

--php stored php_version image
omitted 8.5 easyengine/php8.5
latest 8.5 (was latest) easyengine/php8.5
5.6 … 8.6 that version easyengine/php<v>
row already stored as latest (older release) unchanged easyengine/php8.5

For a new latest site, ee site update --php=8.5 now says Site <site> is already at PHP version: 8.5 (it used to redo the switch to the same image), and --php=8.4 backs the config up to .backup/config/php-8.5 (was php-latest). ee site update --php=latest is still refused by the update options: there is no phplatest.zip config to switch to.

The help text is unchanged: latest is still a valid --php value.

Readers of php_version checked

  • ee site update --php (site-command): "already at" check and backup dir name, as above.
  • ee site clone (site-command): passes the source's stored version as --php, so a clone of a new latest site gets --php=8.5; a source row that still says latest is cloned with --php=latest and the clone stores 8.5. Only app/htdocs is copied; the clone's PHP config is generated for its own version.
  • Backup metadata (phpVersion): records the stored value, now 8.5.
  • ee site info: only --format=json shows php_version (now 8.5); the table has no PHP row.
  • site-command's drop_deprecated_session_sid_settings migration (8.4, 8.5, latest) and pin_latest_php_version migration: unaffected (they act on existing rows).
  • dash-command: posts the stored version; it only runs php -v for latest rows, which new sites no longer have.
  • dash-command's Behat scenario A site on PHP "latest" is posted with the version it really runs creates its fixture with --type=php --php=latest and expects a latest row. Its CI installs site-type-* at dev-develop, so test(behat): seed the latest PHP row instead of creating it dash-command#5 seeds that row directly instead (merged right after this).

Tests

  • Behat: the latest example of "Create a php site on every supported PHP version" now expects php_version 8.5 (new stored column).
  • Unit tests (run locally on PHP 7.4 and 8.5): latest is stored as DEFAULT_PHP_VERSION, and the compose file, custom.ini and the sites row written from it get 8.5; they fail without this change and pass with it, and fail when latest resolves to any other version.

Summary by CodeRabbit

  • New Features
    • PHP version selection now supports latest. It resolves to the current default PHP version, 8.5, which is stored for the site and used in its configuration. Explicitly selected PHP versions continue to be stored and used as selected.

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.
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: PHP latest version storage

Layer / File(s) Summary
Map latest and verify the stored version
src/PHP.php, features/php-version.feature, features/COVERAGE.md
PHP::create() maps latest to DEFAULT_PHP_VERSION. The feature examples assert the stored version, with latest mapped to 8.5. The coverage inventory includes latest and its stored default.

Possibly related PRs

Change: Bug fix

Merge Risk: Minimal · up to cf054

New sites created with --php=latest now store the concrete default version (8.5), so a later default bump will not pair a new image with old PHP configuration. Explicit versions and existing latest rows behave as before. No merge-blocking risk was found.

Security architecture risk: Minimal · up to cf054

New sites keep the PHP version selected at creation instead of silently moving when the default changes. The inspected change does not expand access or weaken existing controls.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed behavior is scoped to sites created through this PHP creation path with latest selected. It does not bulk-rewrite existing sites or alter shared database identities, credentials or resource ownership.

Trust Boundaries and Controls

  • observed — The caller-supplied PHP option continues through the existing supported-version check and compatibility-confirmation logic before normalization. The added branch maps one already accepted literal to a fixed constant; it introduces no arbitrary image reference or new authority-bearing input.

Resilience and Maintainability Implications

  • inferred — The added normalization creates no persistent intermediate state and is idempotent within a release. Inspected exception and interruption handlers retain their existing level-based cleanup and database-ownership inputs, none of which uses php_version. No new partial-failure, retry or concurrent-creation invariant failure was identified; inherited cleanup guarantees remain unverified.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 68bbf3e3-c3eb-426c-9e06-86be566bd4ba
Commits

Reviewing files that changed from the base of the PR and between e9c4f81 and cf054c2.

Files selected for processing: 3

  • features/COVERAGE.md
  • features/php-version.feature
  • src/PHP.php

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@mrrobot47
mrrobot47 merged commit 41a450c into EasyEngine:develop Nov 20, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant