Skip to content

fix:プラグインインストール時のエラーを修正#6567

Merged
ttokoro20240902 merged 1 commit intoEC-CUBE:4.3-symfony7from
dotani1111:dev/fix-plugin-install-error
Jan 14, 2026
Merged

fix:プラグインインストール時のエラーを修正#6567
ttokoro20240902 merged 1 commit intoEC-CUBE:4.3-symfony7from
dotani1111:dev/fix-plugin-install-error

Conversation

@dotani1111
Copy link
Copy Markdown
Contributor

@dotani1111 dotani1111 commented Jan 13, 2026

composer/composerのバージョンを更新し、Rectorクラスをサービス自動登録から除外

  • composer/composerのバージョン制約を^2.0から^2.9に更新 プラグインインストール時に--update-with-dependenciesオプション付きで composer requireが実行される際のセキュリティアドバイザリーによるブロックを防止。

  • services.yamlでRector名前空間をサービス自動登録から除外 AttributeArgumentsOrderRectorはrequire-devにのみ存在するAbstractRectorを継承しており、 本番環境でプラグインインストール時にrector/rectorが削除されるとエラーが発生していた。

概要(Overview・Refs Issue)

方針(Policy)

実装に関する補足(Appendix)

テスト(Test)

相談(Discussion)

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更はありません
  • フックポイントの呼び出しタイミングの変更はありません
  • フックポイントのパラメータの削除・データ型の変更はありません
  • twigファイルに渡しているパラメータの削除・データ型の変更はありません
  • Serviceクラスの公開関数の、引数の削除・データ型の変更はありません
  • 入出力ファイル(CSVなど)のフォーマット変更はありません

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか
    • 権限を超えた操作が可能にならないか
    • 不要なファイルアップロードがないか
    • 外部へ公開されるファイルや機能の追加ではないか
    • テンプレートでのエスケープ漏れがないか

@dotani1111 dotani1111 force-pushed the dev/fix-plugin-install-error branch from 0725c78 to 703fd97 Compare January 13, 2026 04:00
composer/composerのバージョンを更新し、Rectorクラスをサービス自動登録から除外した。

- composer/composerのバージョン制約を^2.0から^2.9に更新
  プラグインインストール時に--update-with-dependenciesオプション付きで
  composer requireが実行される際のセキュリティアドバイザリーによるブロックを防止。

- services.yamlでRector名前空間をサービス自動登録から除外
  AttributeArgumentsOrderRectorはrequire-devにのみ存在するAbstractRectorを継承しており、
  本番環境でプラグインインストール時にrector/rectorが削除されるとエラーが発生していた。
@dotani1111 dotani1111 force-pushed the dev/fix-plugin-install-error branch from 703fd97 to 3c4c246 Compare January 13, 2026 08:06
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.33%. Comparing base (293680c) to head (3c4c246).
⚠️ Report is 8 commits behind head on 4.3-symfony7.

Additional details and impacted files
@@              Coverage Diff              @@
##           4.3-symfony7    #6567   +/-   ##
=============================================
  Coverage         82.33%   82.33%           
=============================================
  Files               482      482           
  Lines             25690    25691    +1     
=============================================
+ Hits              21151    21152    +1     
  Misses             4539     4539           
Flag Coverage Δ
E2E 82.33% <ø> (+<0.01%) ⬆️
Unit 82.33% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nanasess
Copy link
Copy Markdown
Contributor

PR #6567 修正内容の検証結果

問題の根本原因

本番環境(APP_ENV=prod)でのプラグインインストール時に発生するエラーの原因を特定しました。

src/Eccube/Service/Composer/ComposerApiService.php:155,181 で確認:

'--no-dev' => env('APP_ENV') === 'prod',

本番環境では composer install --no-dev が実行され、rector/rector(require-dev)が削除されます。その後、Symfonyがサービスコンテナを再構築する際に、以下のクラスをロードしようとしてエラーが発生します:

  • Eccube\Rector\CodingStyle\AttributeArgumentsOrderRector
  • Eccube\Rector\CodingStyle\NormalizePhpDocArrayGenericSpacingRector

これらは Rector\Rector\AbstractRector(rector/rector パッケージ)を継承しているため、親クラスが見つからずエラーになります。


PR #6567 の修正内容

修正 変更前 変更後
services.yaml exclude: '...Doctrine/ORM/tools/}' exclude: '...Doctrine/ORM/tools/,Rector}'
composer.json "composer/composer": "^2.0" "composer/composer": "^2.9"

妥当性の評価

1. Rector名前空間の除外 ✅ 妥当

  • Rectorクラスは開発時のコード品質向上ツールであり、本番環境で実行する必要がない
  • services.yaml の exclude に追加することで、サービスとして自動登録されなくなる
  • --no-devrector/rector が削除されても、クラスロードエラーが発生しない

2. composer/composer のバージョン更新 ✅ 妥当

  • Composer 2.0〜2.8 にはセキュリティ脆弱性がある
  • --update-with-dependencies オプション付きの composer require がセキュリティアドバイザリーによりブロックされる可能性がある
  • 2.9.x への更新で安定したプラグインインストールが可能になる

PR #6555 との関連性

PR #6555 の変更内容(テストフィクスチャファイルの削除)は、プラグインインストールには直接関係ありません

しかし、PR #6555 のCIが失敗している理由は、ベースブランチ(4.3-symfony7)に Rector 除外の修正が含まれていないためです。

エビデンス:


結論

PR #6567 の修正は妥当であり、PR #6555 で発生しているCI失敗を解消できる見込みです。

推奨アクション:

  1. PR fix:プラグインインストール時のエラーを修正 #6567 を優先的にマージ - プラグインインストール時のエラーを修正
  2. PR fix:プラグインインストール時のエラーを修正 #6567 マージ後に PR refactor(test): SameSiteNoneCompatSessionHandler用テストフィクスチャを削除 #6555 を rebase - CIが通過するはずです

Copy link
Copy Markdown
Contributor

@nanasess nanasess left a comment

Choose a reason for hiding this comment

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

LGTM

@ttokoro20240902 ttokoro20240902 merged commit f35b068 into EC-CUBE:4.3-symfony7 Jan 14, 2026
524 of 526 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.

3 participants