From 70276a8c31c533d3b87d0543f08512998ae94f74 Mon Sep 17 00:00:00 2001 From: soyuka Date: Fri, 26 Jun 2026 15:21:44 +0200 Subject: [PATCH] fix(symfony): allow null $data in PlaceholderAction In event-listener mode a POST with input:false (and no read) never sets the "data" request attribute, so Symfony's argument resolver fails with "Could not resolve argument $data". Default the argument to null, mirroring the non-listener state-machine flow. Closes #8354 --- src/Symfony/EventListener/DeserializeListener.php | 4 ++++ tests/Functional/JsonLd/InputOutputDtoTest.php | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/EventListener/DeserializeListener.php b/src/Symfony/EventListener/DeserializeListener.php index bf34cea24ca..0a00de57633 100644 --- a/src/Symfony/EventListener/DeserializeListener.php +++ b/src/Symfony/EventListener/DeserializeListener.php @@ -76,6 +76,10 @@ public function onKernelRequest(RequestEvent $event): void } if (!$operation->canDeserialize()) { + if (!$request->attributes->has('data')) { + $request->attributes->set('data', null); + } + return; } diff --git a/tests/Functional/JsonLd/InputOutputDtoTest.php b/tests/Functional/JsonLd/InputOutputDtoTest.php index e52474d0f82..45c40db9b26 100644 --- a/tests/Functional/JsonLd/InputOutputDtoTest.php +++ b/tests/Functional/JsonLd/InputOutputDtoTest.php @@ -158,10 +158,6 @@ public function testInputOutputCycle(): void public function testCreateNoInputResource(): void { - if ($_SERVER['USE_SYMFONY_LISTENERS'] ?? false) { - $this->markTestSkipped('PlaceholderAction cannot resolve $data when input:false in event-listener mode.'); - } - $response = self::createClient()->request('POST', '/jsonld_no_inputs', [ 'headers' => ['Accept' => 'application/ld+json'], ]);