Open
Description
TEST
$previous = ['Apples', 'Oranges', 'Bananas', 'Grapes'];
$current = ['Apples', 'Grapes'];
$JsonDiff = new JsonDiff($previous, $current, JsonDiff::REARRANGE_ARRAYS);
$patch = json_decode(json_encode($JsonDiff->getPatch()), true) ?: [];
print_r($patch);
EXPECTED RESULT
When the [1] and [2] position items in the array are successfully removed the patch accurately reflects this
Array ( [0] => Array ( [op] => remove [path] => /1 ) [1] => Array ( [op] => remove [path] => /2) )
ACTUAL RESULT
When [1] and [2] position items in the array are successfully removed the patch only reflects the first item and it's repeated twice. There is no reference to the second item anywhere in the patch response
Array ( [0] => Array ( [op] => remove [path] => /1 ) [1] => Array ( [op] => remove [path] => /1) )
Metadata
Metadata
Assignees
Labels
No labels