From 4b9692a19e06f3cf698d23a3854fd34b9914a32a Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ao2@ao2.it>
Date: Sun, 14 Jan 2018 19:46:54 +0100
Subject: [PATCH 1/1] Tweeper.php: fix converting Instagram data to RSS

There is one new element in the json data served by Instagram named
"404_as_react", and this makes the conversion from json to XML fail
because names starting with a number are illegal in XML.

Fix the problem by prepending an underscore to the problematic name.
---
 src/Tweeper.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Tweeper.php b/src/Tweeper.php
index 8ac2fe3..d60e43b 100644
--- a/src/Tweeper.php
+++ b/src/Tweeper.php
@@ -249,7 +249,10 @@ class Tweeper {
       return NULL;
     }
 
-    return Tweeper::jsonToXml($matches[1], 'instagram');
+    // Filter elements which will result in invalid XML element names.
+    $json = str_replace('404_as_react', '_404_as_react', $matches[1]);
+
+    return Tweeper::jsonToXml($json, 'instagram');
   }
 
   /**
-- 
2.1.4