Skip to content

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

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=wp --php=latest now stores the concrete default version (WordPress::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_WP_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 site on PHP " 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
    • Selecting latest for PHP now saves the current default version, PHP 8.5, as the site’s concrete version. This keeps the selected version stable if the default changes later.
  • Documentation
    • Clarified that latest is pinned to the current default PHP version.

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` row of "Create a site on PHP <php>" 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 version resolution

Layer / File(s) Summary
Resolve and verify the stored PHP version
src/WordPress.php, features/php-version.feature, features/COVERAGE.md
WordPress::create() replaces latest with DEFAULT_PHP_VERSION before configuration and persistence. Feature examples distinguish the requested value from the stored value, and the coverage entry describes 8.5 as the stored default.

Possibly related PRs

  • EasyEngine/site-type-wp#254: Changes the default PHP version and --php=latest resolution in the same code path. The stored value in this change depends on that default.

Change: Bug fix

Merge Risk: Minimal · up to 481e7

New sites created with --php=latest now store the concrete default PHP version, which avoids a mismatch if the default is bumped later. Existing sites that store latest keep working. I see no merge-blocking risk; the external dash-command fixture needs a follow-up after merge, as the author notes.

Security architecture risk: Minimal · up to 481e7

Resolving latest during creation keeps the stored version aligned with runtime selection instead of following future defaults. No introduced security-boundary, ownership, or rollback regression was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed outcome is limited to PHP runtime-selection metadata for new sites requesting latest. The added branch substitutes a fixed supported value; it does not introduce an arbitrary image source, identity, credential, or authority.

Trust Boundaries and Controls

  • observed — CLI PHP input is converted to a trimmed string and checked against the supported list before normalization. The existing unsupported-version fallback and confirmation remain ahead of the new branch; latest is already an accepted value.

Resilience and Maintainability Implications

  • inferred — The normalization does not change site identity checks, creation stages, or local cleanup ownership arguments. Exception and interrupt handlers pass stage, site identity, path, and tracked database ownership to cleanup, without using php_version. This supports no changed cleanup invariant, rather than proving external cleanup or concurrency guarantees.
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: 30fa7af0-63a3-4a87-b8d3-1fd6de5d3542
Commits

Reviewing files that changed from the base of the PR and between e5c259f and 481e786.

Files selected for processing: 3

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

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

@mrrobot47
mrrobot47 merged commit 317be3e 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