Skip to content

fix(templates): drop deprecated session ID ini settings from the PHP 8.4 and 8.5 configs - #519

Open
mrrobot47 wants to merge 6 commits into
EasyEngine:developfrom
mrrobot47:fix/php-session-sid-deprecations
Open

mrrobot47 wants to merge 6 commits into
EasyEngine:developfrom
mrrobot47:fix/php-session-sid-deprecations

Conversation

@mrrobot47

@mrrobot47 mrrobot47 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

What

  • Remove session.sid_length and session.sid_bits_per_character (and their quick-reference entries) from php/php.ini inside templates/config/php-fpm/php84.zip and php85.zip. Companion to fix(php): drop deprecated session ID ini settings from 8.4 and 8.5 dockerfiles#372, which makes the same change in the php8.4 and php8.5 images.
  • Add a container migration that removes the same lines from the PHP config of existing PHP 8.4 and 8.5 sites, so they match a newly created or switched site.
  • Remove templates/config/php-fpm/phplatest.zip, which nothing can select.
  • Add session.upload_progress.enabled = Off to php/php.ini in php81.zip through php85.zip, at the same spot fix(php): turn off session upload progress by default dockerfiles#374 adds it to the 8.1 to 8.5 images.

Why

Both settings are deprecated as of PHP 8.4 and raise an E_DEPRECATED at startup (PHP Startup: session.sid_length INI setting is deprecated), visible in php -i, php-fpm -t and the FPM log whenever error_reporting includes E_DEPRECATED at the ini level. PHP's own php.ini-production for 8.4 and later no longer sets them.

These archives are what ee site update --php=<version> extracts into the site's PHP config, so today a site switched to 8.4 or 8.5 gets the deprecated settings back even once the images are fixed. A site's PHP config is copied from its image only when the site is created, and from the archive only on a PHP version switch, so existing sites keep the settings without a migration.

Migration for existing sites

migrations/container/20261023193000_site-command_drop_deprecated_session_sid_settings.php:

  • Targets php and wp sites whose PHP version is 8.4, 8.5 or latest (which runs the php8.4 image), enabled or disabled. Other versions are not touched: the settings are valid there and their archives keep them.
  • In the site's config/php/php/php.ini it removes every active session.sid_length / session.sid_bits_per_character line, plus the comments shipped right above them and the quick-reference entry, but only where those comments match the shipped text. Every other line, custom.ini and the rest of the config stay as they are. A php.ini as EasyEngine shipped it becomes byte-identical to the one in the new archives apart from the two session.upload_progress.enabled lines below, which come with the images from fix(php): turn off session upload progress by default dockerfiles#374 (every site's custom.ini already sets Off since v4.13.3); a file without the directives is left alone, so it is idempotent.
  • A value other than the shipped 26 / 5 is removed too, with a warning naming the site, the removed line and the backup. The settings are deprecated and go away in PHP 9, and php.ini is replaced wholesale on every PHP version switch anyway, so overrides only last in custom.ini.
  • The previous file is kept as .backup/<site>/php.ini.with-session-sid-settings. php.ini is rewritten in place through one handle, checked to be the regular, singly linked file at that path, because the site's php container can write to that directory after a PHP switch: no temp file or other path is created or followed, and mode, owner and inode stay.
  • PHP-FPM reads php.ini only at start, so the running php container of an enabled site gets the graceful reload ee site reload --php uses (USR2). No container is recreated or restarted; stopped and disabled sites pick the file up when they start.
  • down() restores the saved files and reloads FPM, so core reverts it when a later upgrade step fails. A site that can't be migrated only gets a warning, so it does not block the others.

Behaviour change

For PHP 8.4 and 8.5 sites (switched, or migrated), new session IDs fall back to PHP's defaults: 32 characters of 0-9a-f (128 bits) instead of 26 characters of 0-9a-v (130 bits). IDs issued before are still accepted.

Session upload progress Off in the 8.1 to 8.5 archives

EasyEngine/dockerfiles#374 turns session.upload_progress.enabled Off by default in the 8.1 to 8.5 images' php.ini, right after the commented-out default, with the comment ; Off by default for security; a site's custom.ini can set it to On. The archives get the same two lines at the same spot, so a site switched with ee site update --php gets the php.ini a site created on that version gets. custom.ini is read after php.ini and is copied back on a switch, so session.upload_progress.enabled = On there still wins.

The 5.6 to 8.0 archives stay as they are: the archives mirror the images' php.ini, and those images are not rebuilt and keep PHP's default. Their sites get Off from custom.ini, as every site has since v4.13.3.

Archive contents

Only the php/php.ini entry changes in each archive; every other entry (data, timestamps, permissions, extra fields, order) is byte-identical, checked on the raw local headers and data. Before/after diff of the extracted trees: one file per archive.

The rebuilt entry has a fixed timestamp and the same attributes and extra fields as before, so rebuilding gives the same bytes.

phplatest.zip

The archive is picked by the version a site is switched to (php<version without dots>.zip), and ee site update --php only accepts 5.6 to 8.5, so --php=latest is rejected before anything changes. A site created with --php=latest runs the php8.4 image and gets its config from the image; switching it to another version uses that version's archive. Nothing in site-command, core, site-type-wp or site-type-php refers to phplatest.zip.

Testing

On fresh runners with core develop:

  • the site-command Behat suite with this branch: 8 scenarios passed
  • session upload progress through ee site update --php, with the line removed from custom.ini so FPM shows what php.ini sets: a site created on 8.3, and one switch to 8.2 with the develop archive, report On; switches to 8.1, 8.2, 8.4, 8.5 and back to 8.3 with this branch's archives each have the line in php.ini and FPM reports Off, with no startup warning or deprecation and no session ID lines on 8.4/8.5; with session.upload_progress.enabled = On added to custom.ini, FPM reports On, also after another switch
  • ee site update --php with this branch's archives: 8.3 → 8.4 with the develop archive shows both deprecations and 26-character IDs; → 8.5 → 8.4 with the new archives gives no sid lines, no deprecation, 32-character hex IDs from FPM, and custom.ini preserved
  • the migration: sites created with develop on 8.4 (php), 8.5 (wp), 8.3 (control), latest, 8.4 disabled, 8.4 with a user-edited session.sid_length = 48, and 8.3 switched to 8.4 with the develop archive; then this branch with the version bumped:
    • an upgrade that fails in the image migration reverts the migration: every php.ini, backup and FPM state is back as before
    • the next upgrade leaves every 8.4/8.5/latest php.ini byte-identical to the new archive's, mode, owner and inode kept, backup present, and a php.ini.ee-tmp symlink planted by the site's php container (as www-data) doesn't touch its target; the 8.3 site untouched; custom.ini unchanged everywhere (its max_input_vars still effective)
    • FPM serves 32-character hex session IDs right after the upgrade with no container restarted (same StartedAt), php-fpm -t shows no deprecation, the disabled site does once enabled
    • one warning, for the user-edited site, with the removed value; the backup holds it
    • running the migration again changes nothing (same mtimes, no reload)
    • ee site update --php=latest is rejected and leaves the site unchanged
  • the file rewrite on its own, on PHP 7.4 and 8.5: shipped 8.4/8.5 php.ini, the new one (no-op), CRLF, trailing whitespace and inline comments, user-edited values, an edited comment block (only the directive goes), commented-out and look-alike directives (kept), missing or symlinked php.ini (skipped), a hard-linked php.ini (warning, not changed, next site still migrated), a planted temp-path symlink (target untouched), and down()

…8.4 and 8.5 configs

session.sid_length and session.sid_bits_per_character are deprecated as of PHP 8.4: setting either one raises an E_DEPRECATED at startup whenever error_reporting includes E_DEPRECATED. PHP's own php.ini-production for 8.4 and later no longer sets them.

Remove both directives and their quick-reference entries from php/php.ini in php84.zip and php85.zip. These archives are what `ee site update --php=<version>` installs, so a site switched to 8.4 or 8.5 no longer gets the deprecated settings. Only that entry changes; every other entry is byte-identical.

Newly created session IDs fall back to PHP's defaults, 32 characters of 0-9a-f instead of 26 characters of 0-9a-v. IDs issued before the change are still accepted.
@rtBot
rtBot requested a balanced review from Copilot October 23, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

…d 8.5 sites

A site's php.ini is copied from the PHP image when the site is created and from the version's archive when its PHP version is switched, so existing PHP 8.4 and 8.5 sites keep session.sid_length and session.sid_bits_per_character even with the fixed images and archives. This container migration gives them the same php.ini a new site gets.

It handles php and wp sites on PHP 8.4, 8.5 or `latest` (which runs the php8.4 image), enabled or not. In config/php/php/php.ini it removes every active session.sid_length and session.sid_bits_per_character line, plus the comments shipped right above them and the matching quick reference entry, but only where those comments match the shipped text. Every other line, custom.ini and the other config files stay as they are. A php.ini EasyEngine shipped ends up byte-identical to the one in the archives, and a file that has neither directive is left alone, so running it again changes nothing.

Values other than the shipped 26 and 5 are removed too, with a warning naming the site, the removed line and the backup. Both settings are deprecated as of PHP 8.4 and go away in PHP 9, and php.ini is replaced wholesale on every PHP version switch anyway, so custom.ini is the only place where overrides survive. Keeping an edited value would leave the site with the deprecation and out of step with a switched site.

The previous file is saved as .backup/<site>/php.ini.with-session-sid-settings, and the new file keeps its mode and owner and only replaces the old one once fully written. PHP-FPM reads php.ini only when it starts, so the php container of an enabled site gets the same graceful reload `ee site reload --php` uses (USR2 to FPM) if it's running; stopped or disabled sites pick the file up when they start, and no container is recreated. down() puts the saved files back and reloads FPM again, so a failure later in the upgrade restores the old state. A site that can't be migrated only gets a warning, so it doesn't block the upgrade of the others.
The PHP config archive is picked by the version a site is switched to (`php<version without dots>.zip`), and `ee site update --php` only accepts 5.6 to 8.5, so `latest` never selects it. A site created with `--php=latest` runs the php8.4 image and gets its config from that image, and switching such a site to another version uses the target version's archive. Nothing else in site-command, core, site-type-wp or site-type-php refers to it.

It also still carried the session ID settings deprecated as of PHP 8.4.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The migration’s predictable temporary path permits symlink-based host-file overwrites during a privileged upgrade.

1 open issue

Review effort: Balanced

The site's php container can write to the directory that holds php.ini (www-data owns it after a PHP version switch), so it could plant a symlink at the predictable php.ini.ee-tmp path and have the upgrade write, chmod and chown a host file through it.

The file is now opened once, checked through the open handle to be the same regular, singly linked file as the path (no symlink swapped in after the check, no hard link to another file), and read, written and truncated through that handle. No other path is created or followed, and mode and owner stay as they are. The removal only shortens the file, so writing over it needs no new space; if the write fails anyway, the old content is written back. The backup is written from the content that was read, and down() restores through the same checks.
The directory that holds php.ini is root-owned by default: a PHP version switch makes only conf.d owned by www-data, not the php directory itself. It is still mounted into the site's php container, which is why the rewrite trusts no path in it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The privileged migration modifies existing site configurations and coordinates reloads and upgrade rollback, warranting final human validation.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

…5 configs

Add `session.upload_progress.enabled = Off` to php/php.ini in php81.zip through php85.zip, right after the commented-out default, the same two lines EasyEngine/dockerfiles#374 adds to the 8.1 to 8.5 images. These archives are what `ee site update --php=<version>` installs, so a site switched to one of these versions gets the same php.ini as a site created on it. A site's custom.ini is read after php.ini and still wins, so `session.upload_progress.enabled = On` there turns it back on.

The 5.6 to 8.0 archives stay as they are: their images are not rebuilt and keep PHP's default, and the archives mirror the image's php.ini. Every site's custom.ini already sets Off since v4.13.3.

Only the php/php.ini entry changes; every other entry is byte-identical.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The privileged migration modifies live configuration across sites, so its failure recovery and rollback behavior warrant final human review.

No open issues 🎉

Review effort: Balanced

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.

2 participants