From: Antonio Ospite Date: Sun, 14 Jan 2018 18:46:54 +0000 (+0100) Subject: Tweeper.php: fix converting Instagram data to RSS X-Git-Tag: v1.2.0~8 X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/4b9692a19e06f3cf698d23a3854fd34b9914a32a?ds=inline;hp=63c687219e7eb7e73b366983bc0ee16ee43a9aa1 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. --- 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'); } /**