diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-06-22 08:43:58 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-06-22 17:21:56 +0200 |
commit | 50667dcb82d8a31541ee13fe71c8da4074099ea8 (patch) | |
tree | e5dd47b227e87f430f59e255bd318fdf46e08637 /lib/json.php | |
parent | 432aa58bab91092f6a2bd2065b5fbbcfe3421523 (diff) | |
download | nextcloud-server-50667dcb82d8a31541ee13fe71c8da4074099ea8.tar.gz nextcloud-server-50667dcb82d8a31541ee13fe71c8da4074099ea8.zip |
Convert OC_L10N_String to a string in OC_JSON::encodedPrint
Diffstat (limited to 'lib/json.php')
-rw-r--r-- | lib/json.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/json.php b/lib/json.php index dfc0a7b894e..4eab4fce9f6 100644 --- a/lib/json.php +++ b/lib/json.php @@ -82,6 +82,15 @@ class OC_JSON{ } /** + * Convert OC_L10N_String to string, for use in json encodings + */ + protected static function to_string(&$value){ + if ($value instanceof OC_L10N_String) { + $value = (string)$value; + } + } + + /** * Encode and print $data in json format */ public static function encodedPrint($data,$setContentType=true){ @@ -89,6 +98,7 @@ class OC_JSON{ if($setContentType){ self::setContentTypeHeader(); } + array_walk_recursive($data, array('OC_JSON', 'to_string')); echo json_encode($data); } } |