From 2a599827a1e529b178dfa9e145bf0430e9162be4 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 4 May 2018 12:46:36 -0400
Subject: [PATCH] Better fix.

---
 .../src/VuFindSearch/Backend/BrowZine/Backend.php             | 4 +++-
 .../Backend/BrowZine/Response/RecordCollectionFactory.php     | 4 +---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Backend.php b/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Backend.php
index ca34144ca20..1bedd4c0e00 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Backend.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Backend.php
@@ -107,8 +107,10 @@ class Backend extends AbstractBackend
                 $e
             );
         }
+        // Use array_values and array_filter to strip any nulls out of the
+        // response (these are present sometimes due to an apparent API bug)
         $results = isset($response['data']) && is_array($response['data'])
-            ? $response['data'] : [];
+            ? array_values(array_filter($response['data'])) : [];
         $collection = $this->createRecordCollection(
             [
                 'offset' => $offset,
diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Response/RecordCollectionFactory.php b/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Response/RecordCollectionFactory.php
index 9f97391793d..2a9303dc90b 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Response/RecordCollectionFactory.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Response/RecordCollectionFactory.php
@@ -100,9 +100,7 @@ class RecordCollectionFactory implements RecordCollectionFactoryInterface
         }
         $collection = new $this->collectionClass($response);
         foreach ($response['data'] as $doc) {
-            if (isset($doc['id'])) {
-                $collection->add(call_user_func($this->recordFactory, $doc));
-            }
+            $collection->add(call_user_func($this->recordFactory, $doc));
         }
         return $collection;
     }
-- 
GitLab