Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symfony version(s) affected: 4.2 only (stable and dev)
Description
On a fresh symfony/skeleton:^4.2 installation given the following services:
services: App\InlineDepProvider: ~ App\Consumer: arguments: - '@=service("App\\InlineDepProvider").getInlineDep()' - 'somestring' App\FooCommand: arguments: - '@App\Consumer' tags: ['console.command']
And the corresponding classes:
namespace App; class InlineDep { } class InlineDepProvider { public function getInlineDep(): InlineDep { return new InlineDep(); } } class Consumer { public function __construct(InlineDep $inlineDep, string $somestring) { } } class FooCommand extends Command { public function __construct(Consumer $consumer) { parent::__construct('foo'); } protected function execute(InputInterface $input, OutputInterface $output) { } }
And running bin/console foo:
bin/console foo
[Symfony\Component\Debug\Exception\FatalThrowableError] syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ')' Exception trace: () at /Volumes/HD/Sites/tests/di-42-inline-bug/var/cache/dev/ContainerUpgmmiP/getFooCommandService.php:13
Dumped getFooCommandService.php:
getFooCommandService.php
return $this->services['console.command.public_alias.App\FooCommand'] = new \App\FooCommand(new \App\Consumer(new \App\InlineDepProvider()->getInlineDep(), 'somestring'));
How to reproduce Checkout https://github.com/chalasr/di-42-inline-bug, run composer install and bin/console.
composer install
bin/console
Project created via
composer create-project symfony/skeleton:^4.2 di-42-inline-bug
composer req expressionlanguage
Possible Solution Dumped getFooCommandService.php should look like:
return $this->services['console.command.public_alias.App\FooCommand'] = new \App\FooCommand(new \App\Consumer((new \App\InlineDepProvider())->getInlineDep(), 'somestring'));
(adding parenthesis around new \App\InlineDepProvider() )
new \App\InlineDepProvider()
The text was updated successfully, but these errors were encountered:
bug #29414 [DI] Fix dumping expressions accessing single-use private …
6b38491
…services (chalasr) This PR was merged into the 3.4 branch. Discussion ---------- [DI] Fix dumping expressions accessing single-use private services | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #29403 | License | MIT | Doc PR | n/a Introduced in #27268, see fixed ticket Commits ------- d1e84aa [DI] Fix dumping expressions accessing single-use private services
No branches or pull requests
Symfony version(s) affected: 4.2 only (stable and dev)
Description
On a fresh symfony/skeleton:^4.2 installation given the following services:
And the corresponding classes:
And running
bin/console foo
:Dumped
getFooCommandService.php
:How to reproduce
Checkout https://github.com/chalasr/di-42-inline-bug, run
composer install
andbin/console
.Project created via
composer create-project symfony/skeleton:^4.2 di-42-inline-bug
composer req expressionlanguage
Possible Solution
Dumped
getFooCommandService.php
should look like:(adding parenthesis around
new \App\InlineDepProvider()
)The text was updated successfully, but these errors were encountered: