SimpleDB: Handle XML error
This commit is contained in:
parent
c6b4f2e1d3
commit
c1b0ecda3e
|
@ -394,10 +394,17 @@ if (isset($_GET["simpledb"])) {
|
||||||
'content' => $query,
|
'content' => $query,
|
||||||
'ignore_errors' => 1, // available since PHP 5.2.10
|
'ignore_errors' => 1, // available since PHP 5.2.10
|
||||||
))));
|
))));
|
||||||
if (!$file || !($xml = simplexml_load_string($file))) {
|
if (!$file) {
|
||||||
$connection->error = $php_errormsg;
|
$connection->error = $php_errormsg;
|
||||||
return false;
|
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) {
|
if ($xml->Errors) {
|
||||||
$error = $xml->Errors->Error;
|
$error = $xml->Errors->Error;
|
||||||
$connection->error = "$error->Message ($error->Code)";
|
$connection->error = "$error->Message ($error->Code)";
|
||||||
|
|
Loading…
Reference in a new issue