bug #30026 [VarDumper] dont implement Serializable in Stub (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[VarDumper] dont implement Serializable in Stub

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30014
| License       | MIT
| Doc PR        | -

`Serializable` is really really broken...

Commits
-------

73070d7d32 [VarDumper] dont implement Serializable in Stub
This commit is contained in:
Nicolas Grekas 2019-01-30 12:22:50 +01:00
commit 591c805ccd
1 changed files with 8 additions and 5 deletions

View File

@ -16,7 +16,7 @@ namespace Symfony\Component\VarDumper\Cloner;
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class Stub implements \Serializable
class Stub
{
const TYPE_REF = 1;
const TYPE_STRING = 2;
@ -42,16 +42,19 @@ class Stub implements \Serializable
/**
* @internal
*/
public function serialize()
public function __sleep()
{
return \serialize([$this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr]);
$this->serialized = [$this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr];
return ['serialized'];
}
/**
* @internal
*/
public function unserialize($serialized)
public function __wakeup()
{
list($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr) = \unserialize($serialized);
list($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr) = $this->serialized;
unset($this->serialized);
}
}