Skip to content

Commit a02b1a3

Browse files
authored
Loose comparison causes the value not to be saved when the field is object (#42793)
1 parent cd6e76f commit a02b1a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,8 +1956,8 @@ public function originalIsEquivalent($key)
19561956
return $this->fromDateTime($attribute) ===
19571957
$this->fromDateTime($original);
19581958
} elseif ($this->hasCast($key, ['object', 'collection'])) {
1959-
return $this->castAttribute($key, $attribute) ==
1960-
$this->castAttribute($key, $original);
1959+
return $this->fromJson($attribute) ===
1960+
$this->fromJson($original);
19611961
} elseif ($this->hasCast($key, ['real', 'float', 'double'])) {
19621962
if (($attribute === null && $original !== null) || ($attribute !== null && $original === null)) {
19631963
return false;

0 commit comments

Comments
 (0)