Skip to content

Leave psr/log out of the Phar - #1220

Draft
swissspidy wants to merge 1 commit into
mainfrom
fix/make-phar-exclude-psr-log
Draft

swissspidy wants to merge 1 commit into
mainfrom
fix/make-phar-exclude-psr-log

Conversation

@swissspidy

Copy link
Copy Markdown
Member

Companion to wp-cli/wp-cli#6439, which restarts PHP with OPcache's file cache via composer/xdebug-handler. That brings composer/pcre and psr/log back into WP-CLI's runtime dependencies now that composer/composer is gone (wp-cli/package-command#248).

A bundled psr/log v1 is a known source of clashes with plugins that ship psr/log v2/v3 (wp-cli/wp-cli#4632, wp-cli/wp-cli#5920): WP-CLI's autoloader can answer for Psr\Log first. xdebug-handler never has a logger set (setLogger() isn't called), so psr/log isn't needed at runtime.

This leaves vendor/psr/log out of the Phar and strips its entries from the autoload maps, so WP-CLI's autoloader never answers for Psr\Log. Other psr/* packages are kept as before.

Draft until wp-cli/wp-cli#6439 is merged and the bundle picks up composer/xdebug-handler. Until then the bundle has no psr/log, so this changes nothing yet. The autoload strip pattern was checked against sample classmap, PSR-4 and static-loader lines; a full Phar build with psr/log present hasn't been run yet.


Generated by Claude Code

wp-cli/wp-cli#6439 requires composer/xdebug-handler, which pulls in
psr/log. Its logger is never set, so psr/log isn't needed at runtime.
Leaving it and its autoload map entries out means WP-CLI's autoloader
never answers for Psr\Log, so plugins can load their own version (see
wp-cli/wp-cli#4632 and #5920).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWTd5pwpi2xQfDA6mUYkkx
@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working scope:distribution Related to distribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant