From bf856047445902a9193b8024fecb594e04fd6b8a Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 11 Dec 2015 11:14:47 -0500 Subject: [PATCH] Fixed support for large docs; improved error message. --- module/VuFind/src/VuFind/Harvester/OAI.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/module/VuFind/src/VuFind/Harvester/OAI.php b/module/VuFind/src/VuFind/Harvester/OAI.php index 648ba49f16d..27db58c7321 100644 --- a/module/VuFind/src/VuFind/Harvester/OAI.php +++ b/module/VuFind/src/VuFind/Harvester/OAI.php @@ -495,7 +495,7 @@ class OAI sleep($delay); } } else if (!$result->isSuccess()) { - throw new \Exception('HTTP Error'); + throw new \Exception('HTTP Error ' . $result->getStatusCode()); } else { // If we didn't get an error, we can leave the retry loop: break; @@ -558,8 +558,10 @@ class OAI $xml = $this->sanitizeXML($xml); } - // Parse the XML: - $result = simplexml_load_string($xml); + // Parse the XML (newer versions of LibXML require a special flag for + // large documents, and responses may be quite large): + $flags = LIBXML_VERSION >= 20900 ? LIBXML_PARSEHUGE : 0; + $result = simplexml_load_string($xml, null, $flags); if (!$result) { throw new \Exception("Problem loading XML: {$xml}"); } -- GitLab