Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #18893 [DependencyInjection] Skip deep reference check for 'servi…
…ce_container' (RobertMe) This PR was merged into the 2.3 branch. Discussion ---------- [DependencyInjection] Skip deep reference check for 'service_container' | Q | A | ------------- | --- | Branch? | 2.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The "hasReference" check when dumping the container fails in the case where a service has a method call which includes a reference to a private/inlined service when either that service, or a dependency of it, references the service_container. This because service_container isn't defined while it still tries to check the references of it. So the service_container must be skipped in this case, this shouldn't break anything as the service_container doesn't reference any services, and thus can't reference the service which it is checking for. Commits ------- 6f36733 [DependencyInjection] Skip deep reference check for 'service_container'
- Loading branch information
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use Symfony\Component\DependencyInjection\Container; | ||
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; | ||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; | ||
use Symfony\Component\DependencyInjection\Exception\LogicException; | ||
use Symfony\Component\DependencyInjection\Exception\RuntimeException; | ||
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; | ||
|
||
/** | ||
* ProjectServiceContainer. | ||
* | ||
* This class has been auto-generated | ||
* by the Symfony Dependency Injection Component. | ||
*/ | ||
class ProjectServiceContainer extends Container | ||
{ | ||
private $parameters; | ||
private $targetDirs = array(); | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->services = | ||
$this->scopedServices = | ||
$this->scopeStacks = array(); | ||
$this->scopes = array(); | ||
$this->scopeChildren = array(); | ||
$this->methodMap = array( | ||
'bar' => 'getBarService', | ||
); | ||
|
||
$this->aliases = array(); | ||
} | ||
|
||
/** | ||
* Gets the 'bar' service. | ||
* | ||
* This service is shared. | ||
* This method always returns the same instance of the service. | ||
* | ||
* @return \stdClass A stdClass instance. | ||
*/ | ||
protected function getBarService() | ||
{ | ||
$a = new \stdClass(); | ||
$a->add($this); | ||
|
||
return $this->services['bar'] = new \stdClass($a); | ||
} | ||
} |