Skip to content

Commit

Permalink
Fix crash when operation defaults are missing (#1658)
Browse files Browse the repository at this point in the history
Given that `??` has lower precedence than `+` ([docs](http://php.net/manual/en/language.operators.precedence.php)), this snippet that was intended to fall back to an empty array if defaults are missing instead gave a guaranteed crash as it first tried to add an array and `null` together before coalescing the result.
  • Loading branch information
curry684 authored and dunglas committed Jan 22, 2018
1 parent 63d555a commit d7e498b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Bridge/Symfony/Routing/ApiLoader.php
Expand Up @@ -119,7 +119,7 @@ public function load($data, $type = null): RouteCollection
'collection' => $operation['collection'],
'operationId' => $operationId,
],
] + $operation['defaults'] ?? [],
] + ($operation['defaults'] ?? []),
$operation['requirements'] ?? [],
$operation['options'] ?? [],
$operation['host'] ?? '',
Expand Down

0 comments on commit d7e498b

Please sign in to comment.