Skip to content

fix(cli): avoid phar autoload during self-update#1926

Merged
mrrobot47 merged 1 commit into
EasyEngine:developfrom
mrrobot47:fix/cli-update-phar-autoload
Jul 7, 2026
Merged

fix(cli): avoid phar autoload during self-update#1926
mrrobot47 merged 1 commit into
EasyEngine:developfrom
mrrobot47:fix/cli-update-phar-autoload

Conversation

@mrrobot47

Copy link
Copy Markdown
Member

Summary

Fixes a self-update failure where ee cli update can successfully download and verify the new phar, but then fail after replacement with a PHP parse error from vendor/wp-cli/php-cli-tools/lib/cli/Streams.php.

The updater previously forced cli\Streams and cli\Colors to autoload immediately before replacing the running phar. If the currently installed phar has a broken or incompatible Streams.php, the update can fail even though the downloaded phar is valid.

This change avoids phar-backed logger/color autoloads after replacement by:

  • calculating the updated version message before replacing the phar
  • preserving --quiet behavior before replacement
  • printing the final success message with plain fwrite() after replacement

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.

Pull request overview

This PR fixes a failure mode in ee cli update where the self-update could abort due to autoloading php-cli-tools classes from the currently running (and potentially broken) phar after the phar replacement step.

Changes:

  • Computes the “updated version” message and captures --quiet state before replacing the running phar.
  • Removes forced autoloading of \cli\Streams / \cli\Colors prior to replacement.
  • Emits the final success message via plain fwrite(STDOUT, ...) after replacement (and only when not quiet), avoiding logger/color autoloads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mrrobot47 mrrobot47 merged commit 10c0012 into EasyEngine:develop Jul 7, 2026
9 checks passed
@mrrobot47 mrrobot47 deleted the fix/cli-update-phar-autoload branch July 7, 2026 04:46
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