Skip to content

fix(serializer): reset normalizer caches between requests - #8852

Merged
soyuka merged 3 commits into
api-platform:5.0from
soyuka:fix/serializer-cache-reset
Nov 16, 2026
Merged

soyuka merged 3 commits into
api-platform:5.0from
soyuka:fix/serializer-cache-reset

Conversation

@soyuka

@soyuka soyuka commented Nov 15, 2026

Copy link
Copy Markdown
Member

Our item normalizers keep per-instance caches (componentsCache, attributesCache, localCache, ...) that live as long as the worker in FrankenPHP worker mode, RoadRunner, Swoole or Octane. They now implement ResetInterface and are tagged kernel.reset (reset on RequestHandled on Laravel).

getAttributes() is overridden so that Symfony's private AbstractObjectNormalizer::$attributesCache is never filled, we own the cache and can reset it. CacheKeyTrait also drops request_uri, uri and filters from the key, they change per request and only made the caches grow.

@soyuka
soyuka merged commit 8d745fc into api-platform:5.0 Nov 16, 2026
113 of 117 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.

1 participant