From c918e6d50e8abfaa9fd23d04a23b6ed5def5ef6c Mon Sep 17 00:00:00 2001 From: Aleksi Peebles Date: Wed, 25 Oct 2023 15:40:51 +0300 Subject: [PATCH] Initialize errors variables used in MetadataUtils::loadXML() calls (#147) --- src/RecordManager/Base/Controller/CreatePreview.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/RecordManager/Base/Controller/CreatePreview.php b/src/RecordManager/Base/Controller/CreatePreview.php index 349c3bb94..6726413ca 100644 --- a/src/RecordManager/Base/Controller/CreatePreview.php +++ b/src/RecordManager/Base/Controller/CreatePreview.php @@ -148,6 +148,7 @@ public function launch($metadata, $format, $source) if ('marc' !== $format && substr(trim($metadata), 0, 1) === '<') { $doc = new \DOMDocument(); + $errors = ''; if (false === $this->metadataUtils->loadXML($metadata, $doc, 0, $errors)) { throw new \Exception("Could not parse XML record: $errors"); } @@ -244,6 +245,7 @@ public function getDataSources($format = '') protected function oaipmhTransform($metadata, $transformations) { $doc = new \DOMDocument(); + $errors = ''; if (false === $this->metadataUtils->loadXML($metadata, $doc, 0, $errors)) { throw new \Exception("Could not parse XML record: $errors"); }