From 6f25d3af172422596fc43f396a20d61e48ed96e0 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sun, 10 Jul 2016 13:15:14 +0200 Subject: [PATCH] The processors should not work if the response is empty. --- src/engine/Api/V1/Processors/Minimize.php | 2 +- src/engine/Api/V1/Processors/Paginate.php | 2 +- src/engine/Api/V1/Processors/Search.php | 2 +- src/engine/Api/V1/Processors/Sort.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/engine/Api/V1/Processors/Minimize.php b/src/engine/Api/V1/Processors/Minimize.php index 350fcc66..74fe3e33 100644 --- a/src/engine/Api/V1/Processors/Minimize.php +++ b/src/engine/Api/V1/Processors/Minimize.php @@ -34,7 +34,7 @@ class Minimize implements ProcessorsInterface { * @param array &$response The response array to be processed. */ public static function process(array &$response) { - if (!isset($_GET['fields'])) { + if (!isset($_GET['fields']) || empty($response)) { return; } diff --git a/src/engine/Api/V1/Processors/Paginate.php b/src/engine/Api/V1/Processors/Paginate.php index da56a010..153005d0 100644 --- a/src/engine/Api/V1/Processors/Paginate.php +++ b/src/engine/Api/V1/Processors/Paginate.php @@ -33,7 +33,7 @@ class Paginate implements ProcessorsInterface { * @param array &$response The response array to be processed. */ public static function process(array &$response) { - if (!isset($_GET['page'])) { + if (!isset($_GET['page']) || empty($response)) { return; } diff --git a/src/engine/Api/V1/Processors/Search.php b/src/engine/Api/V1/Processors/Search.php index b22eba05..d8b2a7e2 100644 --- a/src/engine/Api/V1/Processors/Search.php +++ b/src/engine/Api/V1/Processors/Search.php @@ -27,7 +27,7 @@ class Search implements ProcessorsInterface { * @param array &$response The response array to be processed. */ public static function process(array &$response) { - if (!isset($_GET['q'])) { + if (!isset($_GET['q']) || empty($response)) { return; } diff --git a/src/engine/Api/V1/Processors/Sort.php b/src/engine/Api/V1/Processors/Sort.php index 7c72d67c..460ff0c0 100644 --- a/src/engine/Api/V1/Processors/Sort.php +++ b/src/engine/Api/V1/Processors/Sort.php @@ -30,7 +30,7 @@ class Sort implements ProcessorsInterface { * @param array &$response The response array to be processed. */ public static function process(array &$response) { - if (!isset($_GET['sort'])) { + if (!isset($_GET['sort']) || empty($response)) { return; }