From 71347bb9e0c5daca206b0ea32812874e165b7b63 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 6 Aug 2013 03:29:57 -0700 Subject: we've been storing json_encoded structures on disk in several places because it's a lot easier to parse than xml - but OMG do they get mangled - stored as single quoted strings when escaped as if double quoted. We need to use my new function json_decode_plus() wherever we need to parse one of these babies to make sure we get it right. Maybe we should've just used serialize(). --- include/text.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 814c564a3..979fd897a 100755 --- a/include/text.php +++ b/include/text.php @@ -1717,3 +1717,11 @@ function jindent($json) { } +function json_decode_plus($s) { + + $x = json_decode($s,true); + if(! $x) + $x = json_decode(str_replace(array('\\"','\\\\'),array('"','\\'),$s),true); + return $x; + +} \ No newline at end of file -- cgit v1.2.3