Skip to content

Commit 8fad785

Browse files
committed
ignore static properties in serializes model
1 parent 5f520f3 commit 8fad785

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/Illuminate/Queue/SerializesModels.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public function __sleep()
2424
));
2525
}
2626

27-
return array_map(function ($p) {
28-
return $p->getName();
29-
}, $properties);
27+
return array_filter(array_map(function ($p) {
28+
return $p->isStatic() ? null : $p->getName();
29+
}, $properties));
3030
}
3131

3232
/**
@@ -37,6 +37,10 @@ public function __sleep()
3737
public function __wakeup()
3838
{
3939
foreach ((new ReflectionClass($this))->getProperties() as $property) {
40+
if ($property->isStatic()) {
41+
continue;
42+
}
43+
4044
$property->setValue($this, $this->getRestoredPropertyValue(
4145
$this->getPropertyValue($property)
4246
));

0 commit comments

Comments
 (0)