viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Fix a notice related to subsearches, a=chris

Chris Pollett [2019-07-13 00:Jul:th]
Fix a notice related to subsearches, a=chris
Filename
src/controllers/SearchController.php
diff --git a/src/controllers/SearchController.php b/src/controllers/SearchController.php
index a36c63e7c..75d0ed31e 100755
--- a/src/controllers/SearchController.php
+++ b/src/controllers/SearchController.php
@@ -313,15 +313,18 @@ class SearchController extends Controller implements CrawlConstants
         array_unshift($subsearches, ["FOLDER_NAME" => "",
             "SUBSEARCH_NAME" => tl('search_controller_web')]);
         $no_query = false;
-        if (isset($_REQUEST["s"])) {
+        if (!empty($_REQUEST["s"])) {
             $search_found = false;
             foreach ($subsearches as $search) {
-                if ($search["FOLDER_NAME"] == $_REQUEST["s"]) {
+                if ($search["FOLDER_NAME"] === $_REQUEST["s"]) {
+                    if (empty($search["INDEX_IDENTIFIER"]) ||
+                        empty($search["PER_PAGE"])) {
+                        continue;
+                    }
                     $search_found = true;
-                    $this->subsearch_name = $_REQUEST["s"];
+                    $this->subsearch_name = $search["FOLDER_NAME"];
                     $this->subsearch_identifier = $search["INDEX_IDENTIFIER"];
-                    if (!isset($_REQUEST['num']) &&
-                        isset($search["PER_PAGE"])) {
+                    if (!isset($_REQUEST['num'])) {
                         $_REQUEST['num'] = $search["PER_PAGE"];
                     }
                     break;
ViewGit