diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Backend.php b/module/VuFindSearch/src/VuFindSearch/Backend/BrowZine/Backend.php index ca34144ca205d20c7d410d9c8ce3c08711702158..1bedd4c0e00a827024e4ef06904ed38e4b46e19d 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 9f97391793ddd102ae45393548ea3344d739e0d6..2a9303dc90b060d70d64eefb3e90639802cff7b0 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; }