Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5b1a96a

Browse filesBrowse files
bug #21942 [DI] Fix dumping null ServiceClosureArgument (nicolas-grekas)
This PR was merged into the 3.3-dev branch. Discussion ---------- [DI] Fix dumping null ServiceClosureArgument | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21941 | License | MIT | Doc PR | - Commits ------- 35977fd [DI] Fix dumping null ServiceClosureArgument
2 parents 7f6f402 + 35977fd commit 5b1a96a
Copy full SHA for 5b1a96a

File tree

3 files changed

+5
-1
lines changed
Filter options

3 files changed

+5
-1
lines changed

‎src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,7 @@ private function dumpValue($value, $interpolate = true)
16901690
return $this->export($value);
16911691
}
16921692

1693-
private function dumpServiceClosure(Reference $reference, $interpolate, $oneLine)
1693+
private function dumpServiceClosure(Reference $reference = null, $interpolate, $oneLine)
16941694
{
16951695
$code = $this->dumpValue($reference, $interpolate);
16961696

‎src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,10 @@ public function testServiceLocator()
657657
->addArgument(array(
658658
'bar' => new ServiceClosureArgument(new Reference('bar_service')),
659659
'baz' => new ServiceClosureArgument(new TypedReference('baz_service', 'stdClass')),
660+
'nil' => $nil = new ServiceClosureArgument(new Reference('nil')),
660661
))
661662
;
663+
$nil->setValues(array(null));
662664
$container->register('bar_service', 'stdClass')->setArguments(array(new Reference('baz_service')));
663665
$container->register('baz_service', 'stdClass')->setPublic(false);
664666
$container->compile();

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ protected function getFooServiceService()
8888
return ${($_ = isset($this->services['bar_service']) ? $this->services['bar_service'] : $this->get('bar_service')) && false ?: '_'};
8989
}, 'baz' => function () {
9090
$f = function (\stdClass $v) { return $v; }; return $f(${($_ = isset($this->services['baz_service']) ? $this->services['baz_service'] : $this->getBazServiceService()) && false ?: '_'});
91+
}, 'nil' => function () {
92+
return NULL;
9193
}));
9294
}
9395

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.