From cc4f850a37adc87ecd28cdbb1c955b17c012bb0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Novotn=C3=BD?= <witiko@mail.muni.cz> Date: Fri, 29 Jun 2018 18:59:53 +0200 Subject: [PATCH] Aleph driver: add extra sanity checks to parseId --- module/VuFind/src/VuFind/ILS/Driver/Aleph.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/module/VuFind/src/VuFind/ILS/Driver/Aleph.php b/module/VuFind/src/VuFind/ILS/Driver/Aleph.php index 52abb9f9f17..6daf4f34474 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Aleph.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Aleph.php @@ -575,10 +575,17 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, protected function parseId($id) { if (count($this->bib) == 1) { - return [$this->bib[0], $id]; + $retval = [$this->bib[0], $id]; } else { - return explode('-', $id); + $retval = explode('-', $id); } + if (count($retval) != 2) { + throw new \Exception("The resulting array has incorrect size"); + } + if (!in_array($retval[0], $this->bib)) { + throw new \Exception("The resulting array contains unknown library ID"); + } + return $retval; } /** -- GitLab