-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unused methods of OC_Json #8791
Conversation
lib/private/legacy/api.php
Outdated
@@ -485,7 +485,10 @@ public static function renderResult($format, $meta, $data) { | |||
), | |||
); | |||
if ($format == 'json') { | |||
return OC_JSON::encode($response); | |||
if (is_array($response)) { | |||
array_walk_recursive($response, array('OC_JSON', 'to_string')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of dark hackery is this
server/lib/private/legacy/json.php
Line 173 in fac0a11
$value = (string)$value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not ask question you don't want answered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's basically an object which use cast to a string (calling then the __toString()
method explicitly). Otherwise the json_encode
would fail with an error, that it only can serialize strings, integer, bool and date (the types it knows how to serialize).
lib/private/legacy/eventsource.php
Outdated
@@ -89,6 +89,13 @@ protected function init() { | |||
flush(); | |||
} | |||
|
|||
private function encode($data) { | |||
if (is_array($data)) { | |||
array_walk_recursive($data, array('OC_JSON', 'to_string')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not even a public method
server/lib/private/legacy/json.php
Line 171 in fac0a11
protected static function to_string(&$value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:/ Need to work on this yes :/
cbb5bb8
to
fae5b1b
Compare
Codecov Report
@@ Coverage Diff @@
## master #8791 +/- ##
============================================
+ Coverage 51.89% 51.93% +0.04%
- Complexity 25278 25279 +1
============================================
Files 1604 1607 +3
Lines 94798 94872 +74
Branches 1377 1377
============================================
+ Hits 49193 49275 +82
+ Misses 45605 45597 -8
|
fae5b1b
to
0a004fb
Compare
Ready for review again. I dropped the public interfaces that aren't used outside of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
0a004fb
to
78211a5
Compare
@ChristophWurst @skjnldsv Ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
Ref #8375 and #7827