From ac61c8a6985da5a4294e1b11701cdec16f627bfb Mon Sep 17 00:00:00 2001 From: Luk Puk Date: Wed, 28 Jun 2017 16:03:22 +0200 Subject: [PATCH] Placeholder treated as NULL for item-type/collection search criteria --- application/models/Table/Item.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/application/models/Table/Item.php b/application/models/Table/Item.php index c7c6383ad2..0a62cfede8 100644 --- a/application/models/Table/Item.php +++ b/application/models/Table/Item.php @@ -197,10 +197,11 @@ public function filterByCollection($select, $collections) if (is_numeric($collection)) { return (int) $collection; } - return; + return ''; }, $collections); - $hasEmpty = in_array(null, $collectionIds); + // strict check to skip placeholder (empty string) + $hasEmpty = in_array(null, $collectionIds, true); $collectionIds = array_filter($collectionIds); if (!empty($collectionIds)) { $select->joinLeft( @@ -245,10 +246,11 @@ public function filterByItemType($select, $types) if (is_string($type)) { return $type; } - return; + return ''; }, $types); - $hasEmpty = in_array(null, $typeIdsOrNames); + // strict check to skip placeholder (empty string) + $hasEmpty = in_array(null, $typeIdsOrNames, true); $typeIdsOrNames = array_filter($typeIdsOrNames); if ($typeIdsOrNames) { $select->joinLeft(array(