Skip to content

Commit 51650a0

Browse files
committed
Added __unserialize method to all reflections with __serialize to fix Symfony cache issue
1 parent 8faf375 commit 51650a0

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

src/ClassReflection.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,13 @@ public function __serialize(): array
602602
return $vars;
603603
}
604604

605+
public function __unserialize(array $data): void
606+
{
607+
foreach ($data as $name => $value) {
608+
$this->{$name} = $value;
609+
}
610+
}
611+
605612
public function __clone()
606613
{
607614
if ((debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['class'] ?? null) !== self::class) {

src/MethodReflection.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,13 @@ public function __serialize(): array
362362
return $data;
363363
}
364364

365+
public function __unserialize(array $data): void
366+
{
367+
foreach ($data as $name => $value) {
368+
$this->{$name} = $value;
369+
}
370+
}
371+
365372
public function __clone()
366373
{
367374
if ((debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['class'] ?? null) !== self::class) {

src/ParameterReflection.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ public function __serialize(): array
107107
return $data;
108108
}
109109

110+
public function __unserialize(array $data): void
111+
{
112+
foreach ($data as $name => $value) {
113+
$this->{$name} = $value;
114+
}
115+
}
116+
110117
/**
111118
* @return ?positive-int
112119
*/

src/PropertyReflection.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ public function __serialize(): array
161161
return $data;
162162
}
163163

164+
public function __unserialize(array $data): void
165+
{
166+
foreach ($data as $name => $value) {
167+
$this->{$name} = $value;
168+
}
169+
}
170+
164171
public function __clone()
165172
{
166173
if ((debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['class'] ?? null) !== self::class) {

0 commit comments

Comments
 (0)