SimpleDB: Handle XML error

This commit is contained in:
Jakub Vrana 2013-07-06 22:33:19 -07:00
parent c6b4f2e1d3
commit c1b0ecda3e

View file

@ -394,10 +394,17 @@ if (isset($_GET["simpledb"])) {
'content' => $query,
'ignore_errors' => 1, // available since PHP 5.2.10
))));
if (!$file || !($xml = simplexml_load_string($file))) {
if (!$file) {
$connection->error = $php_errormsg;
return false;
}
libxml_use_internal_errors(true);
$xml = simplexml_load_string($file);
if (!$xml) {
$error = libxml_get_last_error();
$connection->error = $error->message;
return false;
}
if ($xml->Errors) {
$error = $xml->Errors->Error;
$connection->error = "$error->Message ($error->Code)";