From 20ade5d41da27cde28d4762274a28a6ddca58928 Mon Sep 17 00:00:00 2001 From: Karl Wackerberg Date: Mon, 12 Oct 2026 17:45:56 +0200 Subject: [PATCH] fix(symfony): tag SkolemIriConverter with kernel.reset #7829 made SkolemIriConverter implement ResetInterface, but the service definition is not tagged, so Symfony's services_resetter never calls reset() and the object map keeps growing in long-running workers. Tag the service and assert the tag in the extension test. Co-Authored-By: Claude Sonnet 5.5 --- src/Symfony/Bundle/Resources/config/api.php | 3 ++- .../DependencyInjection/ApiPlatformExtensionTest.php | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/Resources/config/api.php b/src/Symfony/Bundle/Resources/config/api.php index 817be1aa96a..91f8ce1d406 100644 --- a/src/Symfony/Bundle/Resources/config/api.php +++ b/src/Symfony/Bundle/Resources/config/api.php @@ -252,7 +252,8 @@ ->tag('routing.loader'); $services->set('api_platform.symfony.iri_converter.skolem', SkolemIriConverter::class) - ->args([service('api_platform.router')]); + ->args([service('api_platform.router')]) + ->tag('kernel.reset', ['method' => 'reset']); $services->set('api_platform.api.identifiers_extractor', IdentifiersExtractor::class) ->args([ diff --git a/src/Symfony/Tests/Bundle/DependencyInjection/ApiPlatformExtensionTest.php b/src/Symfony/Tests/Bundle/DependencyInjection/ApiPlatformExtensionTest.php index 0f3fe8a6099..c9f737cb68e 100644 --- a/src/Symfony/Tests/Bundle/DependencyInjection/ApiPlatformExtensionTest.php +++ b/src/Symfony/Tests/Bundle/DependencyInjection/ApiPlatformExtensionTest.php @@ -202,6 +202,17 @@ public function testObjectMapperDoesNotLoadDeprecatedTranslationCommand(): void self::assertFalse(class_exists(FrameworkTranslationExtractCommand::class, false)); } + public function testSkolemIriConverterIsResetBetweenRequests(): void + { + (new ApiPlatformExtension())->load(self::DEFAULT_CONFIG, $this->container); + + $this->assertServiceHasTags('api_platform.symfony.iri_converter.skolem', ['kernel.reset']); + $this->assertSame( + [['method' => 'reset']], + $this->container->getDefinition('api_platform.symfony.iri_converter.skolem')->getTag('kernel.reset'), + ); + } + public function testCommonConfiguration(): void { $config = self::DEFAULT_CONFIG;