Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jun 6, 2024
1 parent d9d168b commit a023e7a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions framework/db/BaseActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -1781,9 +1781,15 @@ private function setRelationDependencies($name, $relation, $viaRelationName = nu
*/
private function isValueDifferent($newValue, $oldValue)
{
if (is_array($newValue) && is_array($oldValue) && ArrayHelper::isAssociative($oldValue)) {
$newValue = ArrayHelper::recursiveSort($newValue);
$oldValue = ArrayHelper::recursiveSort($oldValue);
if (is_array($newValue) && is_array($oldValue)) {
// Only sort associative arrays
$sorter = function(&$array) {
if (ArrayHelper::isAssociative($array)) {
ksort($array);
}
};
$newValue = ArrayHelper::recursiveSort($newValue, $sorter);
$oldValue = ArrayHelper::recursiveSort($oldValue, $sorter);
}

return $newValue !== $oldValue;
Expand Down

0 comments on commit a023e7a

Please sign in to comment.