8000 [DependencyInjection] PhpDumper, abstract service and factory. · Issue #17353 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[DependencyInjection] PhpDumper, abstract service and factory. #17353
Closed
@fbourigault

Description

@fbourigault

While using Symfony 2.7.6 (composer update won't let me update to 2.7.8 even with a ^2.7.0 dependency :/) and csa/guzzle-bundle 2.0.4 and guzzlehttp/guzzle 6.1.1 I encountered a bug that lead to generate the following code in appDevDebugProjectContainer.php (I removed some sensitive data):

    /**
     * Gets the 'csa_guzzle.client.my_client' service.
     *
     * This service is shared.
     * This method always returns the same instance of the service.
     *
     * @return \GuzzleHttp\Client A GuzzleHttp\Client instance.
     */
    protected function getCsaGuzzle_Client_MyClientService()
    {
        $a = new \UL();
        $a->push($this->get('csa_guzzle.middleware.stopwatch'), 'stopwatch');
        $a->push($this->get('csa_guzzle.middleware.logger'), 'logger');
        $a->push($this->get('csa_guzzle.middleware.history'), 'history');

        return $this->services['csa_guzzle.client.my_client'] = new \GuzzleHttp\Client(array('base_uri' => 'https://...', 'headers' => array('Authorization' => <
5DA1
span class="pl-s">'Bearer ...', 'Content-Type' => '...'), 'on_stats' => array(0 => $this->get('csa_guzzle.data_collector.guzzle'), 1 => 'addStats'), 'handler' => $a));
    }

The service is defined from an abstract service using a factory:
https://github.com/csarrazi/CsaGuzzleBundle/blob/v2.0.4/src/Resources/config/middleware.xml#L9
and decorated in a compiler pass:
https://github.com/csarrazi/CsaGuzzleBundle/blob/v2.0.4/src/DependencyInjection/CompilerPass/MiddlewarePass.php#L117

I did some debug in PhpDumper and notice that in:
https://github.com/symfony/symfony/blob/v2.7.6/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php#L752
the $class value returned is NULL and:
https://github.com/symfony/symfony/blob/v2.7.6/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php#L800
makes it look like $a = new \UL().

I don't know if it's a csa/guzzle-bundle misuse of DependencyInjection or a bug in the PhpDumper class.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0