Skip to content

Commit 435d493

Browse files
mhbertdunglas
andcommitted
Bugfix: Notice: Undefined index: method thrown in SerializerContextBu… (#3128)
* Bugfix: Notice: Undefined index: method thrown in SerializerContextBuilder (since version 2.5.0) - switch the order of the checks in the if statement to prevent checking for non-existent 'method' key in $operation check. * Update src/Serializer/SerializerContextBuilder.php Co-Authored-By: Kévin Dunglas <[email protected]>
1 parent b5e933e commit 435d493

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Serializer/SerializerContextBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function createFromRequest(Request $request, bool $normalization, array $
9494
}
9595

9696
foreach ($resourceMetadata->getItemOperations() as $operation) {
97-
if ('PATCH' === $operation['method'] && \in_array('application/merge-patch+json', $operation['input_formats']['json'] ?? [], true)) {
97+
if ('PATCH' === ($operation['method'] ?? '') && \in_array('application/merge-patch+json', $operation['input_formats']['json'] ?? [], true)) {
9898
$context['skip_null_values'] = true;
9999

100100
break;

0 commit comments

Comments
 (0)