Skip to content

Fix deploy: stop compiling the DI container - #350

Closed
AydinHassan wants to merge 1 commit into
masterfrom
fix-container-compile
Closed

AydinHassan wants to merge 1 commit into
masterfrom
fix-container-compile

Conversation

@AydinHassan

Copy link
Copy Markdown
Member

The launch deploy (run 40085754610) failed in deploy:clear-cache. With CACHE.ENABLE=true, ContainerFactory compiles the container, and PHP-DI can't compile php-workshop's eventListeners: containerListener() returns fn() => new ContainerListenerHelper(...), which captures variables. The error was Cannot compile closures which import variables using the use keyword.

This drops container compilation. That only caches the DI container. Redis and the page cache still use CACHE.ENABLE.

Testing: reproduced the crash on master with CACHE.ENABLE=true; with this change bin/app starts. PHPUnit (145 tests) and PHPStan level 9 pass.

A proper fix would make containerListener() compilable in php-workshop, after which compilation could come back.

php-workshop's listener definitions are closures, which PHP-DI can't
compile, so the deploy failed in clear-cache with CACHE.ENABLE=true.
@AydinHassan

Copy link
Copy Markdown
Member Author

Replaced by the real fix, php-school/php-workshop#332, plus a composer.lock bump here.

@AydinHassan
AydinHassan deleted the fix-container-compile branch October 24, 2026 10:33
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