Skip to content
Snippets Groups Projects
Commit 87df244c authored by David Maus's avatar David Maus
Browse files

Throw BackendException on SRU XSLT processing error

* VuFindSearch/Backend/SRU/Connector.php (process): Throw
  BackendException on XSLT processing error, don't check for XML
  prolog.
parent ec40a184
No related merge requests found
...@@ -261,18 +261,19 @@ class Connector implements LoggerAwareInterface ...@@ -261,18 +261,19 @@ class Connector implements LoggerAwareInterface
* Process an SRU response. Returns either the raw XML string or a * Process an SRU response. Returns either the raw XML string or a
* SimpleXMLElement based on the contents of the class' raw property. * SimpleXMLElement based on the contents of the class' raw property.
* *
* @param string $result SRU response * @param string $response SRU response
* *
* @return string|SimpleXMLElement * @return string|SimpleXMLElement
*/ */
protected function process($result) protected function process($response)
{ {
if (substr($result, 0, 5) != '<?xml') {
throw new BackendException('Cannot Load Results');
}
// Send back either the raw XML or a SimpleXML object, as requested: // Send back either the raw XML or a SimpleXML object, as requested:
$result = XSLTProcessor::process('sru-convert.xsl', $result); $result = XSLTProcessor::process('sru-convert.xsl', $response);
if (!$result) {
throw new BackendException(
sprintf('Error processing SRU response: %20s', $response)
);
}
return $this->raw ? $result : simplexml_load_string($result); return $this->raw ? $result : simplexml_load_string($result);
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment