Skip to content

Commit 686bfd8

Browse files
Merge branch '2.8' into 3.0
* 2.8: (22 commits) Fix merge [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 [WebProfilerBundle] Fix invalid CSS style Added progressive jpeg to mime types guesser [Yaml] Fix wrong line number when comments are inserted in the middle of a block. Fixed singular of committee Do not inject web debug toolbar on attachments bumped Symfony version to 2.8.8 updated VERSION for 2.8.7 updated CHANGELOG for 2.8.7 bumped Symfony version to 2.7.15 updated VERSION for 2.7.14 update CONTRIBUTORS for 2.7.14 ... Conflicts: CHANGELOG-2.7.md CHANGELOG-3.0.md src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php src/Symfony/Component/HttpKernel/Kernel.php
2 parents 2b0aaca + 099c93b commit 686bfd8

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
@@ -172,10 +172,16 @@ private function validateSchema($file, \DOMDocument $dom, $schema)
172172
{
173173
$internalErrors = libxml_use_internal_errors(true);
174174

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

183+
libxml_disable_entity_loader($disableEntities);
184+
179185
$dom->normalizeDocument();
180186

181187
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)