From 8fad785de66ffaa18e7d8b9e9cd7c4465e60daac Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 23 Jan 2018 12:06:02 -0600 Subject: [PATCH] ignore static properties in serializes model --- src/Illuminate/Queue/SerializesModels.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Queue/SerializesModels.php b/src/Illuminate/Queue/SerializesModels.php index 62f7e7218e9a..15c4af3c4918 100644 --- a/src/Illuminate/Queue/SerializesModels.php +++ b/src/Illuminate/Queue/SerializesModels.php @@ -24,9 +24,9 @@ public function __sleep() )); } - return array_map(function ($p) { - return $p->getName(); - }, $properties); + return array_filter(array_map(function ($p) { + return $p->isStatic() ? null : $p->getName(); + }, $properties)); } /** @@ -37,6 +37,10 @@ public function __sleep() public function __wakeup() { foreach ((new ReflectionClass($this))->getProperties() as $property) { + if ($property->isStatic()) { + continue; + } + $property->setValue($this, $this->getRestoredPropertyValue( $this->getPropertyValue($property) ));