Fix invalid foreach in SharingBlacklist.php#36038
Conversation
Codecov Report
@@ Coverage Diff @@
## master #36038 +/- ##
=======================================
Coverage 54.01% 54.01%
=======================================
Files 63 63
Lines 7404 7404
Branches 1309 1309
=======================================
Hits 3999 3999
Misses 3019 3019
Partials 386 386
Continue to review full report at Codecov.
|
|
@phil-davis any update ? |
I thought it was going to be an easy/obvious fix - silly me. Now I need to spend some time "hardening" against this setting being potentially any invalid JSON or weird JSON. |
c0d3e4b to
0bf22e0
Compare
|
@jvillafanez @PVince81 I switched around the logic so that the code is in the private method I added a more general check using Please review. |
|
Note that this needs unittests to cover this new case. |
ab44629 to
e0154c1
Compare
|
@jvillafanez or anybody - ready for review again. |
d7c5ea7 to
8f1df37
Compare
|
@jvillafanez I refactored stuff - please review again. |
jvillafanez
left a comment
There was a problem hiding this comment.
one last thing and we're done
8f1df37 to
36d978c
Compare
|
@jvillafanez ready for review again |
|
@phil-davis I am merging this change. |
|
Cannot share to blacklisted group with group names like "0", "1", "1.23", "1.23e-4" on the desktop sync client 2.6.0 RC1, macOS 10.14.6 and testpilot 2.5.4 |
Description
The "string" value that it is set to is supposed to be valid JSON representing an array of group ids.
blacklisted_receiver_groupscan be set "manually" by the administrator using anocccommand, or by some automated test or... So it can end up being an empty string, or some string that is not valid JSON, or some string that represents a multi-level nested array-of-arrays, or some other weird structure.If the JSON decode does not produce an array, then return an empty list. (JSON decode might have failed, or returned a plain string/int etc)
Check the elements of the decoded array. Keep elements that are "string-like" (string, int and float) and cast them to string. Discard other elements (e.g. an array, or boolean). This allows for group names like "0", "1", "1.23", "1.23e-4" that can look like both numbers and strings, while discarding other crud.
Related Issue
How Has This Been Tested?
Local run of acceptance test and observe that the log message no longer happens.
Types of changes
Checklist: