From 278097b6b4eac2cc0445edc52236db43e3a7b01f Mon Sep 17 00:00:00 2001 From: soyuka Date: Tue, 18 Nov 2025 11:05:58 +0100 Subject: [PATCH] fix(state): never map a response --- src/State/Processor/ObjectMapperProcessor.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/State/Processor/ObjectMapperProcessor.php b/src/State/Processor/ObjectMapperProcessor.php index c749c3f8f8..3f0074d744 100644 --- a/src/State/Processor/ObjectMapperProcessor.php +++ b/src/State/Processor/ObjectMapperProcessor.php @@ -16,6 +16,7 @@ use ApiPlatform\Metadata\Operation; use ApiPlatform\State\ProcessorInterface; use Symfony\Component\ObjectMapper\ObjectMapperInterface; +use Symfony\Component\HttpFoundation\Response; /** * @implements ProcessorInterface @@ -36,7 +37,8 @@ public function process(mixed $data, Operation $operation, array $uriVariables = $class = $operation->getInput()['class'] ?? $operation->getClass(); if ( - !$this->objectMapper + $data instanceof Response + || !$this->objectMapper || !$operation->canWrite() || null === $data || !is_a($data, $class, true)