Skip to content
Snippets Groups Projects
Commit 894188f3 authored by Alex Barth's avatar Alex Barth
Browse files

#724184 ekes: catch failures when parsing for PubSubHubbub hub and self.

parent f837b411
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
Feeds 6.x 1.0 xxxxx xx, 2010-xx-xx
----------------------------------
- #724184 ekes: catch failures when parsing for PubSubHubbub hub and self.
- #706984 lyricnz: Add FeedsSimplePie::parseExtensions() to allow parsing to be
customized.
- #728854 Scott Reynolds: Fix $queue->createItem() fails.
......
......@@ -75,14 +75,17 @@ class PuSHSubscriber {
curl_setopt($request, CURLOPT_RETURNTRANSFER, TRUE);
$data = curl_exec($request);
if (curl_getinfo($request, CURLINFO_HTTP_CODE) == 200) {
$xml = new SimpleXMLElement($data);
$xml->registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom');
if (empty($hub) && $hub = @current($xml->xpath("//atom:link[attribute::rel='hub']"))) {
$hub = (string) $hub->attributes()->href;
}
if ($self = @current($xml->xpath("//atom:link[attribute::rel='self']"))) {
$self = (string) $self->attributes()->href;
try {
$xml = new SimpleXMLElement($data);
$xml->registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom');
if (empty($hub) && $hub = @current($xml->xpath("//atom:link[attribute::rel='hub']"))) {
$hub = (string) $hub->attributes()->href;
}
if ($self = @current($xml->xpath("//atom:link[attribute::rel='self']"))) {
$self = (string) $self->attributes()->href;
}
}
catch (Exception $e) {}
}
curl_close($request);
// Fall back to $url if $self is not given.
......
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