Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca06211

Browse filesBrowse files
[VarDumper] fix serializing Stub instances
1 parent eb32993 commit ca06211
Copy full SHA for ca06211

File tree

1 file changed

+21
-10
lines changed
Filter options
  • src/Symfony/Component/VarDumper/Cloner

1 file changed

+21
-10
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Cloner/Stub.php
+21-10Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,33 @@ class Stub
3939
public $position = 0;
4040
public $attr = [];
4141

42+
private static $defaultProperties = [];
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::$defaultProperties[$c = \get_class($this)])) {
52+
self::$defaultProperties[$c] = get_class_vars($c);
5153

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);
54+
$r = new \ReflectionClass($c);
55+
56+
foreach ($r->getProperties() as $v) {
57+
if ($v->isStatic()) {
58+
unset(self::$defaultProperties[$c][$v->name]);
59+
}
60+
}
61+
}
62+
63+
foreach (self::$defaultProperties[$c] as $k => $v) {
64+
if ($this->$k !== $v) {
65+
$properties[] = $k;
66+
}
67+
}
68+
69+
return $properties;
5970
}
6071
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.