Skip to content

Commit

Permalink
[DependencyInjection] Fix #29694 - cannot serialize \Closure
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony MARTIN <anthony.martin@sensiolabs.com>
  • Loading branch information
Anthony MARTIN committed Jan 31, 2019
1 parent 9429fac commit 9e8f450
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/Symfony/Component/DependencyInjection/Definition.php
Expand Up @@ -68,6 +68,41 @@ public function __construct($class = null, array $arguments = [])
$this->arguments = $arguments;
}

public function __sleep()
{
if ($this->hasErrors()) {
//By calling it, we resolve all potentials \Closure inside $this->>errors
$this->getErrors();
}

return [
'class',
'file',
'factory',
'shared',
'deprecated',
'deprecationTemplate',
'properties',
'calls',
'instanceof',
'autoconfigured',
'configurator',
'tags',
'public',
'private',
'synthetic',
'abstract',
'lazy',
'decoratedService',
'autowired',
'changes',
'bindings',
'errors',
'arguments',
'innerServiceId',
];
}

/**
* Returns all changes tracked for the Definition object.
*
Expand Down

0 comments on commit 9e8f450

Please sign in to comment.