mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Fix Herald to accept new JSON encoding of sparse arrays
Summary: JX.JSON was recently changed to use JSON.stringify (the native implementation) if it is available. The native implementation has a behavioral difference from the Javelin implementation, in that it does not compact sparse arrays. Ignore nulls resulting from removals when processing the encoded action and condition lists. Test Plan: Removed conditions from Herald rules. Reviewed By: aran Reviewers: aran, cpojer, jungejason CC: aran, epriestley Differential Revision: 606
This commit is contained in:
parent
49310391e0
commit
62532ef26d
1 changed files with 11 additions and 0 deletions
|
@ -93,6 +93,12 @@ class HeraldRuleController extends HeraldController {
|
|||
|
||||
$conditions = array();
|
||||
foreach ($data['conditions'] as $condition) {
|
||||
if ($condition === null) {
|
||||
// We manage this as a sparse array on the client, so may receive
|
||||
// NULL if conditions have been removed.
|
||||
continue;
|
||||
}
|
||||
|
||||
$obj = new HeraldCondition();
|
||||
$obj->setFieldName($condition[0]);
|
||||
$obj->setFieldCondition($condition[1]);
|
||||
|
@ -149,6 +155,11 @@ class HeraldRuleController extends HeraldController {
|
|||
|
||||
$actions = array();
|
||||
foreach ($data['actions'] as $action) {
|
||||
if ($action === null) {
|
||||
// Sparse on the client; removals can give us NULLs.
|
||||
continue;
|
||||
}
|
||||
|
||||
$obj = new HeraldAction();
|
||||
$obj->setAction($action[0]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue