From 50667dcb82d8a31541ee13fe71c8da4074099ea8 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 22 Jun 2012 08:43:58 +0200 Subject: Convert OC_L10N_String to a string in OC_JSON::encodedPrint --- lib/json.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/json.php') diff --git a/lib/json.php b/lib/json.php index dfc0a7b894e..4eab4fce9f6 100644 --- a/lib/json.php +++ b/lib/json.php @@ -81,6 +81,15 @@ class OC_JSON{ self::encodedPrint($data); } + /** + * 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 */ @@ -89,6 +98,7 @@ class OC_JSON{ if($setContentType){ self::setContentTypeHeader(); } + array_walk_recursive($data, array('OC_JSON', 'to_string')); echo json_encode($data); } } -- cgit v1.2.3