From 6774e880ed75f1a1cc059a92837cee3588cf86ff Mon Sep 17 00:00:00 2001 From: Phyks Date: Fri, 18 Jul 2014 23:13:33 +0200 Subject: [PATCH] Check for errors at HTML parsing --- favicon.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/favicon.php b/favicon.php index 512e6c2..9380caa 100644 --- a/favicon.php +++ b/favicon.php @@ -47,8 +47,14 @@ function getFavicon($urls) { $html = new DOMDocument(); $html->strictErrorChecking = false; - @$html->loadHTML($content); + $success = @$html->loadHTML($content); + if($success === false) { + continue; + } $xml = simplexml_import_dom($html); + if($xml === false) { + continue; + } // Try to fetch the favicon URL from the tag foreach($xml->head->children() as $head_tag) {