Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="autowiring-type" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
</xsd:choice>
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="id" type="service_id" />
<xsd:attribute name="class" type="xsd:string" />
<xsd:attribute name="shared" type="boolean" />
<xsd:attribute name="scope" type="xsd:string" />
Expand Down Expand Up @@ -209,4 +209,10 @@
<xsd:pattern value="(%.+%|true|false)" />
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="service_id">
<xsd:restriction base="xsd:string">
<xsd:pattern value="([^._-][a-z0-9._-]+[^._-])" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="._-foo-_." class="Foo">
</service>
</services>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,15 @@ public function testAutowire()

$this->assertTrue($container->getDefinition('bar')->isAutowired());
}

/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
* @expectedExceptionMessageRegExp /Unable to parse file ".+.xml"/
*/
public function testParsingServiceWithNonValidIdThrowsException()
{
$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
$loader->load('services25.xml');
}
}