Skip to content

Commit 0ae7be5

Browse files
ArshidArshid
authored andcommitted
Replace __wakeup with __unserialize for object unserialization
1 parent c6129f1 commit 0ae7be5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Illuminate/Database/Eloquent/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,7 +2586,7 @@ public function escapeWhenCastingToString($escape = true)
25862586
*
25872587
* @return array
25882588
*/
2589-
public function __sleep()
2589+
public function __serialize()
25902590
{
25912591
$this->mergeAttributesFromCachedCasts();
25922592

@@ -2595,7 +2595,7 @@ public function __sleep()
25952595
$this->relationAutoloadCallback = null;
25962596
$this->relationAutoloadContext = null;
25972597

2598-
return array_keys(get_object_vars($this));
2598+
return get_object_vars($this);
25992599
}
26002600

26012601
/**

src/Illuminate/Queue/Middleware/RateLimited.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ protected function getTimeUntilNextRetry($key)
147147
*
148148
* @return array
149149
*/
150-
public function __sleep()
150+
public function __serialize()
151151
{
152152
return [
153-
'limiterName',
154-
'shouldRelease',
153+
'limiterName' => $this->limiterName,
154+
'shouldRelease' => $this->shouldRelease,
155155
];
156156
}
157157

tests/Integration/Cache/Fixtures/Unserializable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class Unserializable
88
{
9-
public function __sleep()
9+
public function __serialize()
1010
{
1111
throw new Exception('Not serializable');
1212
}

0 commit comments

Comments
 (0)