Skip to content
Permalink
Browse files

bug #30026 [VarDumper] dont implement Serializable in Stub (nicolas-g…

…rekas)

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
-------

73070d7 [VarDumper] dont implement Serializable in Stub
  • Loading branch information...
nicolas-grekas committed Jan 30, 2019
2 parents fb2f57d + 73070d7 commit 591c805ccd4bba280315f9498b3234beaf2d164c
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/Symfony/Component/VarDumper/Cloner/Stub.php
@@ -16,7 +16,7 @@
*
* @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);
}
}

0 comments on commit 591c805

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.