Skip to content

Commit

Permalink
Prevent serializing default values (#41348)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriaanzon authored Mar 7, 2022
1 parent 52b2b26 commit 22c2cee
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Illuminate/Queue/SerializesModels.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ public function __serialize()
continue;
}

$value = $this->getPropertyValue($property);

if ($property->hasDefaultValue() && $value === $property->getDefaultValue()) {
continue;
}

$name = $property->getName();

if ($property->isPrivate()) {
Expand All @@ -79,9 +85,7 @@ public function __serialize()
$name = "\0*\0{$name}";
}

$values[$name] = $this->getSerializedPropertyValue(
$this->getPropertyValue($property)
);
$values[$name] = $this->getSerializedPropertyValue($value);
}

return $values;
Expand Down

0 comments on commit 22c2cee

Please sign in to comment.