]> source.dussan.org Git - nextcloud-server.git/commitdiff
Convert OC_L10N_String to a string in OC_JSON::encodedPrint
authorBart Visscher <bartv@thisnet.nl>
Fri, 22 Jun 2012 06:43:58 +0000 (08:43 +0200)
committerBart Visscher <bartv@thisnet.nl>
Fri, 22 Jun 2012 15:21:56 +0000 (17:21 +0200)
lib/json.php

index dfc0a7b894e199187a3d9487c44094b6a431c302..4eab4fce9f6e5700d9c7ba44bc3f11a76d0ca193 100644 (file)
@@ -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);
                }
        }