Fix issue when a user does not have permissions to use any search object type
authorMarcel Werk <burntime@woltlab.com>
Mon, 15 Aug 2022 16:30:09 +0000 (18:30 +0200)
committerMarcel Werk <burntime@woltlab.com>
Mon, 15 Aug 2022 16:30:09 +0000 (18:30 +0200)
wcfsetup/install/files/lib/system/search/SearchHandler.class.php

index 352452959500ae1bd9e231d56c162de814b5851f..c86229de3ebb312e209d4a986b7c6f24c44e8db0 100644 (file)
@@ -74,6 +74,12 @@ final class SearchHandler
             return null;
         }
 
+        // Check if at least one object type is selected.
+        // It may happen that a user does not have permission to use any object type.
+        if ($this->objectTypeNames === []) {
+            return null;
+        }
+
         $this->buildSearchHash();
 
         if (($search = $this->getExistingSearch()) !== null) {