Skip to content

Commit 9150ac7

Browse files
committed
the string "0" is a valid service identifier
1 parent bf7fb47 commit 9150ac7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Loader/XmlFileLoader.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase =
496496

497497
switch ($arg->getAttribute('type')) {
498498
case 'service':
499-
if (!$arg->getAttribute('id')) {
499+
if ('' === $arg->getAttribute('id')) {
500500
throw new InvalidArgumentException(sprintf('Tag "<%s>" with type="service" has no or empty "id" attribute in "%s".', $name, $file));
501501
}
502502
if ($arg->hasAttribute('strict')) {
@@ -549,7 +549,7 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase =
549549
* @param \DOMNode $node
550550
* @param mixed $name
551551
*
552-
* @return array
552+
* @return \DOMElement[]
553553
*/
554554
private function getChildren(\DOMNode $node, $name)
555555
{

Tests/Fixtures/xml/services6.xml

+4
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,9 @@
6161
</service>
6262
<service id="alias_for_foo" alias="foo" />
6363
<service id="another_alias_for_foo" alias="foo" public="false" />
64+
<service id="0" class="FooClass" />
65+
<service id="1" class="FooClass">
66+
<argument type="service" id="0" />
67+
</service>
6468
</services>
6569
</container>

0 commit comments

Comments
 (0)