aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-06 03:29:57 -0700
committerfriendica <info@friendica.com>2013-08-06 03:29:57 -0700
commit71347bb9e0c5daca206b0ea32812874e165b7b63 (patch)
tree7985aedbba169de0bc307110eb24c23638e475a8 /include/text.php
parent576b815f9b40997e45cd87f3e8e2f373afca1f11 (diff)
downloadvolse-hubzilla-71347bb9e0c5daca206b0ea32812874e165b7b63.tar.gz
volse-hubzilla-71347bb9e0c5daca206b0ea32812874e165b7b63.tar.bz2
volse-hubzilla-71347bb9e0c5daca206b0ea32812874e165b7b63.zip
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().
Diffstat (limited to 'include/text.php')
-rwxr-xr-xinclude/text.php8
1 files changed, 8 insertions, 0 deletions
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