From 894188f3ef62c9d7c115f97c7da4aecc5df3b2f0 Mon Sep 17 00:00:00 2001
From: Alex Barth <alex_b@53995.no-reply.drupal.org>
Date: Tue, 2 Mar 2010 14:54:35 +0000
Subject: [PATCH] #724184 ekes: catch failures when parsing for PubSubHubbub
 hub and self.

---
 CHANGELOG.txt                |  1 +
 libraries/PuSHSubscriber.inc | 17 ++++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 3bf5b44e..5367b879 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -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.
diff --git a/libraries/PuSHSubscriber.inc b/libraries/PuSHSubscriber.inc
index 5a98b556..39c3b655 100644
--- a/libraries/PuSHSubscriber.inc
+++ b/libraries/PuSHSubscriber.inc
@@ -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.
-- 
GitLab