ignore malformed xml before it hits the parser.

This commit is contained in:
Friendika 2010-12-02 18:32:46 -08:00
parent 2ef6ad80a4
commit e09d164882

View file

@ -115,6 +115,7 @@
logger('poller: handshake with url ' . $url . ' returns xml: ' . $xml, LOGGER_DATA); logger('poller: handshake with url ' . $url . ' returns xml: ' . $xml, LOGGER_DATA);
if(! $xml) { if(! $xml) {
logger("poller: $url appears to be dead - marking for death "); logger("poller: $url appears to be dead - marking for death ");
// dead connection - might be a transient event, or this might // dead connection - might be a transient event, or this might
@ -132,6 +133,15 @@
continue; continue;
} }
if(! strstr($xml,'<?xml')) {
logger('poller: response from ' . $url . ' did not contain XML.');
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(datetime_convert()),
intval($contact['id'])
);
continue;
}
$res = simplexml_load_string($xml); $res = simplexml_load_string($xml);