From 5036cda33fe52a0ba65caa90d400f9313019c187 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Fri, 30 Nov 2018 14:40:10 +0200
Subject: [PATCH] SierraRest: Avoid a notice if patron's name doesn't have two
 parts. (#1280)

---
 module/VuFind/src/VuFind/ILS/Driver/SierraRest.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/ILS/Driver/SierraRest.php b/module/VuFind/src/VuFind/ILS/Driver/SierraRest.php
index 1f013f66797..f4708ed0252 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/SierraRest.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/SierraRest.php
@@ -404,7 +404,9 @@ class SierraRest extends AbstractBase implements TranslatorAwareInterface,
         $lastname = '';
         if (!empty($result['names'])) {
             $name = $result['names'][0];
-            list($lastname, $firstname) = explode(', ', $name, 2);
+            $parts = explode(', ', $name, 2);
+            $lastname = $parts[0];
+            $firstname = $parts[1] ?? '';
         }
         return [
             'id' => $result['id'],
-- 
GitLab