Skip to content
Snippets Groups Projects
Commit 54f23d38 authored by wltb's avatar wltb
Browse files

Feedparser: Store libXML fatal error messages in an array, repair error reporting

parent 4d49863f
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
class FeedParser { class FeedParser {
private $doc; private $doc;
private $error; private $error;
private $libxml_errors = array();
private $items; private $items;
private $link; private $link;
private $title; private $title;
...@@ -63,12 +64,12 @@ class FeedParser { ...@@ -63,12 +64,12 @@ class FeedParser {
} }
} }
$this->error = "";
if ($error) { if ($error) {
foreach (libxml_get_errors() as $error) { foreach (libxml_get_errors() as $error) {
if ($error->level == LIBXML_ERR_FATAL) { if ($error->level == LIBXML_ERR_FATAL) {
$this->error = $this->format_error($error); if(!isset($this->error)) //currently only the first error is reported
break; //break here because currently we only show one error $this->error = $this->format_error($error);
$this->libxml_errors [] = $this->format_error($error);
} }
} }
} }
...@@ -216,6 +217,10 @@ class FeedParser { ...@@ -216,6 +217,10 @@ class FeedParser {
return $this->error; return $this->error;
} }
function errors() {
return $this->libxml_errors;
}
function get_link() { function get_link() {
return $this->link; return $this->link;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment