Skip to content

Commit

Permalink
bug #30026 [VarDumper] dont implement Serializable in Stub (nicolas-g…
Browse files Browse the repository at this point in the history
…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 591c805
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Symfony/Component/VarDumper/Cloner/Stub.php
Expand Up @@ -16,7 +16,7 @@
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class Stub implements \Serializable
class Stub
{
const TYPE_REF = 1;
const TYPE_STRING = 2;
Expand All @@ -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.