diff --git a/module/VuFind/src/VuFind/Controller/CollectionsController.php b/module/VuFind/src/VuFind/Controller/CollectionsController.php index a2ef51816e6b29998e8eb6337803e3164d939b4e..d62386910fcced39457d344d180097bc0953f941 100644 --- a/module/VuFind/src/VuFind/Controller/CollectionsController.php +++ b/module/VuFind/src/VuFind/Controller/CollectionsController.php @@ -178,7 +178,8 @@ class CollectionsController extends AbstractBase $result = $searchObject->getFullFieldFacets( [$browseField], false, 150000, 'index' ); - $result = $result[$browseField]['data']['list']; + $result = isset($result[$browseField]['data']['list']) + ? $result[$browseField]['data']['list'] : []; $delimiter = $this->getBrowseDelimiter(); foreach ($result as $rkey => $collection) { diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrMarc.php b/module/VuFind/src/VuFind/RecordDriver/SolrMarc.php index 1dd41657b98bd0ba88d8055fc987b6797517bc1a..9e788f26e8012c7ea77c5c6961ef77e8d58b990f 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SolrMarc.php +++ b/module/VuFind/src/VuFind/RecordDriver/SolrMarc.php @@ -509,7 +509,7 @@ class SolrMarc extends SolrDefault // Loop through all subfields, collecting results that match the whitelist; // note that it is important to retain the original MARC order here! $allSubfields = $currentField->getSubfields(); - if (count($allSubfields) > 0) { + if (!empty($allSubfields)) { foreach ($allSubfields as $currentSubfield) { if (in_array($currentSubfield->getCode(), $subfields)) { // Grab the current subfield value and act on it if it is @@ -523,7 +523,7 @@ class SolrMarc extends SolrDefault } // Send back the data in a different format depending on $concat mode: - return $concat ? [implode($separator, $matches)] : $matches; + return $concat && $matches ? [implode($separator, $matches)] : $matches; } /** diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php b/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php index db7ea75626aeeef2d9c9c2270c4ffe51911fe489..45266fe9fc22ae727bdec7ed06782940c323cff7 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Piwik.php @@ -266,7 +266,11 @@ class Piwik extends \Zend\View\Helper\AbstractHelper protected function getCombinedSearchResults() { $viewModel = $this->getView()->plugin('view_model'); - $children = $viewModel->getCurrent()->getChildren(); + $current = $viewModel->getCurrent(); + if (null === $current) { + return null; + } + $children = $current->getChildren(); if (isset($children[0])) { $results = $children[0]->getVariable('combinedResults'); if (is_array($results)) { @@ -526,7 +530,7 @@ EOT; $searchType = $escape($params->getSearchType()); $resultCount = 0; foreach ($combinedResults as $currentSearch) { - if ($currentSearch['ajax']) { + if (!empty($currentSearch['ajax'])) { // Some results fetched via ajax, so report that we don't know the // result count. $resultCount = 'false';