From cbcaa488edfc7aba66e970d6ff3616d0ea49ccca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateu=20Aguil=C3=B3=20Bosch?= Date: Mon, 21 Dec 2015 10:33:25 +0100 Subject: [PATCH] [BUGFIX] Avoid warning for invalid filters When an invalid filter is provided, throw the appropriate error and avoid additional warnings. --- src/Plugin/resource/DataProvider/DataProvider.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Plugin/resource/DataProvider/DataProvider.php b/src/Plugin/resource/DataProvider/DataProvider.php index 04f1bafa..01d079bb 100644 --- a/src/Plugin/resource/DataProvider/DataProvider.php +++ b/src/Plugin/resource/DataProvider/DataProvider.php @@ -97,10 +97,10 @@ public static function processFilterInput($filter, $public_field) { // filter[foo]=bar would be converted to filter[foo][value] = bar. $filter = array('value' => $filter); } + if (!isset($filter['value'])) { + throw new BadRequestException(sprintf('Value not present for the "%s" filter. Please check the URL format.', $public_field)); + } if (!is_array($filter['value'])) { - if (!isset($filter['value'])) { - throw new BadRequestException(sprintf('Value not present for the "%s" filter. Please check the URL format.', $public_field)); - } $filter['value'] = array($filter['value']); } // Add the property.