Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d3ec5b

Browse files
[VarDumper] fix serializing Stub instances
1 parent eb32993 commit 2d3ec5b

File tree

1 file changed

+13
-10
lines changed
  • src/Symfony/Component/VarDumper/Cloner

1 file changed

+13
-10
lines changed

src/Symfony/Component/VarDumper/Cloner/Stub.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,25 @@ class Stub
3939
public $position = 0;
4040
public $attr = [];
4141

42+
private static $defaults = [];
43+
4244
/**
4345
* @internal
4446
*/
4547
public function __sleep()
4648
{
47-
$this->serialized = [$this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr];
49+
$properties = [];
4850

49-
return ['serialized'];
50-
}
51+
if (!isset(self::$defaults[$c = \get_class($this)])) {
52+
self::$defaults[$c] = get_class_vars($c);
53+
}
5154

52-
/**
53-
* @internal
54-
*/
55-
public function __wakeup()
56-
{
57-
list($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr) = $this->serialized;
58-
unset($this->serialized);
55+
foreach (self::$defaults[$c] as $k => $v) {
56+
if ($this->$k !== $v) {
57+
$properties[] = $k;
58+
}
59+
}
60+
61+
return $properties;
5962
}
6063
}

0 commit comments

Comments
 (0)