aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/legacy')
-rw-r--r--lib/private/legacy/OC_API.php2
-rw-r--r--lib/private/legacy/OC_EventSource.php4
-rw-r--r--lib/private/legacy/OC_JSON.php14
3 files changed, 4 insertions, 16 deletions
diff --git a/lib/private/legacy/OC_API.php b/lib/private/legacy/OC_API.php
index 862e73e6edd..facd08c1d2f 100644
--- a/lib/private/legacy/OC_API.php
+++ b/lib/private/legacy/OC_API.php
@@ -171,7 +171,7 @@ class OC_API {
],
];
if ($format == 'json') {
- return OC_JSON::encode($response);
+ return json_encode($response, JSON_HEX_TAG);
}
$writer = new XMLWriter();
diff --git a/lib/private/legacy/OC_EventSource.php b/lib/private/legacy/OC_EventSource.php
index cd72ba1f2d5..49fde4a214f 100644
--- a/lib/private/legacy/OC_EventSource.php
+++ b/lib/private/legacy/OC_EventSource.php
@@ -113,13 +113,13 @@ class OC_EventSource implements \OCP\IEventSource {
}
if ($this->fallback) {
$response = '<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack('
- . $this->fallBackId . ',"' . $type . '",' . OC_JSON::encode($data) . ')</script>' . PHP_EOL;
+ . $this->fallBackId . ',"' . ($type ?? '') . '",' . json_encode($data, JSON_HEX_TAG) . ')</script>' . PHP_EOL;
echo $response;
} else {
if ($type) {
echo 'event: ' . $type . PHP_EOL;
}
- echo 'data: ' . OC_JSON::encode($data) . PHP_EOL;
+ echo 'data: ' . json_encode($data, JSON_HEX_TAG) . PHP_EOL;
}
echo PHP_EOL;
flush();
diff --git a/lib/private/legacy/OC_JSON.php b/lib/private/legacy/OC_JSON.php
index b9cfb8210e0..b6791fe4b85 100644
--- a/lib/private/legacy/OC_JSON.php
+++ b/lib/private/legacy/OC_JSON.php
@@ -114,22 +114,10 @@ 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\L10NString) {
- $value = (string)$value;
- }
- }
-
- /**
* Encode JSON
* @deprecated Use a AppFramework JSONResponse instead
*/
- public static function encode($data) {
- if (is_array($data)) {
- array_walk_recursive($data, ['OC_JSON', 'to_string']);
- }
+ private static function encode($data) {
return json_encode($data, JSON_HEX_TAG);
}
}