Skip to content

Commit 17bb6af

Browse files
committed
[Autocomplete] Rethrow BadRequestHttpException in case of malformed extra_options
1 parent 32224c4 commit 17bb6af

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Autocomplete/src/Controller/EntityAutocompleteController.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ private function getExtraOptions(Request $request): array
7676
return [];
7777
}
7878

79-
$extraOptions = $this->getDecodedExtraOptions($request->query->getString(self::EXTRA_OPTIONS));
79+
try {
80+
$extraOptions = $this->getDecodedExtraOptions($request->query->getString(self::EXTRA_OPTIONS));
81+
} catch (\JsonException) {
82+
throw new BadRequestHttpException('The extra options cannot be parsed.');
83+
}
8084

8185
if (!\array_key_exists(AutocompleteChoiceTypeExtension::CHECKSUM_KEY, $extraOptions)) {
8286
throw new BadRequestHttpException('The extra options are missing the checksum.');

0 commit comments

Comments
 (0)