Repository navigation
Stop requiring mercure_publish() to create FrankenPHP's built-in hub - #136
Merged
dunglas merged 2 commits intoNov 2, 2026
Merged
Conversation
dunglas
approved these changes
Oct 11, 2026
HubFactory threw when mercure_publish() was not defined, which FrankenPHP only does when serving a request. HubRegistry creates every hub, also for code that only subscribes (Authorization, Discovery, the Twig extension), so a built-in hub broke wherever that code ran under the CLI: cache:warmup building the Twig environment, a Messenger worker rendering an email, Doctrine fixtures triggering Turbo broadcasts. symfony/mercure 0.9 checks for the function in FrankenPhpHub::publish() instead (symfony/mercure#145), so require it and drop the check here: only publishing needs FrankenPHP now.
guillaume-sainthillier
force-pushed
the
drop-mercure-publish-check
branch
from
October 12, 2026 09:43
e2b2656 to
69e597e
Compare
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to symfony/mercure#145.
The bug
HubFactorythrows whenmercure_publish()isn't defined, but FrankenPHP only defines it when serving a request.HubRegistrycreates every hub, including for code that only ever subscribes:Authorization,Discovery, and the Twig extension (eagerly built with Twig 3). So with FrankenPHP's built-in hub (nourl), anything under the CLI that touches that code fails, even though it never publishes:cache:warmup, as the Twig template warmer builds the Twig environmentBefore #128,
FrankenPhpHubwas registered directly without any check, so this is a 0.6.0 regression.The fix
symfony/mercure 0.9.0 now checks for the function in
FrankenPhpHub::publish()and throws an explicitRuntimeExceptionthere (symfony/mercure#145). This requiressymfony/mercure^0.9, dropping^0.8, and removes the creation-time check fromHubFactory. Building the built-in hub now works anywhere; only publishing needs FrankenPHP.The bundle already passes
protocol_versionexplicitly to every class whose default changed in 0.9, so dropping 0.8 doesn't change the bundle's behavior. It does mean apps still onsymfony/mercure0.8 have to upgrade it.Tests
HubFactoryTestno longer needs themercure_publish()stub nor separate processes: the built-in hub is created whether or not the function exists, and a new test checks publishing without it throwssymfony/mercure's exception. The stub fixture is removed.No CHANGELOG entry, as 0.6.0 is tagged and the version to ship this in is yours to pick. Suggested entry: