Skip to content

Commit 099c93b

Browse files
Merge branch '2.7' into 2.8
* 2.7: [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5 [Console] fixed PHPDoc [travis] HHVM 3.12 LTS Fix feature detection for IE [Form] Fixed collapsed choice attributes [Console] added explanation of messages usage in a progress bar force enabling the external XML entity loaders [Yaml] properly count skipped comment lines Conflicts: src/Symfony/Component/Translation/Loader/XliffFileLoader.php
2 parents 8a1648d + 979e3a5 commit 099c93b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Loader/XliffFileLoader.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,16 @@ private function validateSchema($file, \DOMDocument $dom, $schema)
173173
{
174174
$internalErrors = libxml_use_internal_errors(true);
175175

176+
$disableEntities = libxml_disable_entity_loader(false);
177+
176178
if (!@$dom->schemaValidateSource($schema)) {
179+
libxml_disable_entity_loader($disableEntities);
180+
177181
throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s', $file, implode("\n", $this->getXmlErrors($internalErrors))));
178182
}
179183

184+
libxml_disable_entity_loader($disableEntities);
185+
180186
$dom->normalizeDocument();
181187

182188
libxml_clear_errors();

Tests/Loader/XliffFileLoaderTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ public function testLoadWithInternalErrorsEnabled()
4646
libxml_use_internal_errors($internalErrors);
4747
}
4848

49+
public function testLoadWithExternalEntitiesDisabled()
50+
{
51+
$disableEntities = libxml_disable_entity_loader(true);
52+
53+
$loader = new XliffFileLoader();
54+
$resource = __DIR__.'/../fixtures/resources.xlf';
55+
$catalogue = $loader->load($resource, 'en', 'domain1');
56+
57+
libxml_disable_entity_loader($disableEntities);
58+
59+
$this->assertEquals('en', $catalogue->getLocale());
60+
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
61+
}
62+
4963
public function testLoadWithResname()
5064
{
5165
$loader = new XliffFileLoader();

0 commit comments

Comments
 (0)