[VarDumper] fix serializing Stub instances
This commit is contained in:
parent
eb3299341f
commit
46d6a4d9ec
@ -39,22 +39,29 @@ class Stub
|
|||||||
public $position = 0;
|
public $position = 0;
|
||||||
public $attr = [];
|
public $attr = [];
|
||||||
|
|
||||||
|
private static $defaultProperties = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public function __sleep()
|
public function __sleep()
|
||||||
{
|
{
|
||||||
$this->serialized = [$this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr];
|
$properties = [];
|
||||||
|
|
||||||
return ['serialized'];
|
if (!isset(self::$defaultProperties[$c = \get_class($this)])) {
|
||||||
}
|
self::$defaultProperties[$c] = get_class_vars($c);
|
||||||
|
|
||||||
/**
|
foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) {
|
||||||
* @internal
|
unset(self::$defaultProperties[$c][$k]);
|
||||||
*/
|
}
|
||||||
public function __wakeup()
|
}
|
||||||
{
|
|
||||||
list($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr) = $this->serialized;
|
foreach (self::$defaultProperties[$c] as $k => $v) {
|
||||||
unset($this->serialized);
|
if ($this->$k !== $v) {
|
||||||
|
$properties[] = $k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $properties;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user