Skip to content

Commit 48c56aa

Browse files
Merge branch '3.1'
* 3.1: (30 commits) Fix merge [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5 [Console] fixed PHPDoc [Cache] Fix double fetch in ProxyAdapter [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 Fixed singular of committee Do not inject web debug toolbar on attachments Fixed issue with legacy client initialization [FrameworkBundle] Remove unused variable bumped Symfony version to 3.0.8 updated VERSION for 3.0.7 ...
2 parents f22e1fd + b36e79d commit 48c56aa

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
@@ -177,10 +177,16 @@ private function validateSchema($file, \DOMDocument $dom, $schema)
177177
{
178178
$internalErrors = libxml_use_internal_errors(true);
179179

180+
$disableEntities = libxml_disable_entity_loader(false);
181+
180182
if (!@$dom->schemaValidateSource($schema)) {
183+
libxml_disable_entity_loader($disableEntities);
184+
181185
throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s', $file, implode("\n", $this->getXmlErrors($internalErrors))));
182186
}
183187

188+
libxml_disable_entity_loader($disableEntities);
189+
184190
$dom->normalizeDocument();
185191

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