From 35a4b518aae845b4d68a044b4734deb4ffa2ae06 Mon Sep 17 00:00:00 2001 From: Ere Maijala <ere.maijala@helsinki.fi> Date: Thu, 12 Dec 2019 15:36:22 +0200 Subject: [PATCH] Avoid PHP error if Alma API response doesn't contain an error message. (#1522) - This can happen at least if the API key is valid but not properly routing to the Alma instance. --- module/VuFind/src/VuFind/ILS/Driver/Alma.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/VuFind/src/VuFind/ILS/Driver/Alma.php b/module/VuFind/src/VuFind/ILS/Driver/Alma.php index aebad97d66a..54bc30d7ded 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Alma.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Alma.php @@ -226,7 +226,8 @@ class Alma extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterface } $returnValue = $xml; } else { - $almaErrorMsg = $xml->errorList->error[0]->errorMessage; + $almaErrorMsg = $xml->errorList->error[0]->errorMessage + ?? '[could not parse error message]'; error_log( '[ALMA] ' . $almaErrorMsg . ' | Call to: ' . $client->getUri() . '. GET params: ' . var_export($paramsGet, true) . '. POST params: ' . -- GitLab