Repository navigation
Conversation
…eb#329 A ChildDefinition does not inherit its parent's tags, so the per-firewall authenticator and provider preparation listener were never reset. The authenticator's parent definition carried no kernel.reset tag at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Fixes #329.
A
ChildDefinitiondoes not inherit its parent's tags, so the per-firewall services that implementResetInterfacewere never reset and kept their state across requests under a persistent worker (FrankenPHP, RoadRunner, Swoole). Under PHP-FPM every request builds a new container, which is why this has gone unnoticed.Three tags, not two — the authenticator needed both halves:
security.phpkernel.resetadded to thescheb_two_factor.security.authenticatorparent, which had no such tag at allTwoFactorFactory::createAuthenticator()TwoFactorServicesFactory::createProviderPreparationListener()TrustedDeviceTokenStorageis the only otherResetInterfaceimplementation in the bundle; it is registered with a plainset()rather than aChildDefinitionand is already tagged, so it is unaffected.On testing this reliably
You asked whether this could be covered without a compiler pass for the runtime execution.
tests/DependencyInjection/ResettableServicesAreTaggedTest.phpasserts the property rather than a list of ids: it loads the extension, creates one firewall's services throughTwoFactorFactory, runsResolveChildDefinitionsPassso the children get their parents' classes, then requireskernel.reseton every resolved definition whose class implementsResetInterface, found by reflection.A resettable service added later without the tag fails this test without anyone remembering to extend it. A second arm asserts at least one resettable definition was found, so the first cannot pass vacuously against an empty container.
Red control — reverting the three tag additions, with the test left in place:
The vacuity arm stayed green. With the fix restored:
OK (2 tests, 2 assertions).Checks
vendor/bin/phpunitTests: 480, Assertions: 1513— OKvendor/bin/phpcsvendor/bin/psalmNo errors found!php-cs-fixer fix --dry-runFound 0 of 257 files that can be fixed