Skip to content

Commit 536a1b8

Browse files
committed
disable entity loader
1 parent 94cf1ae commit 536a1b8

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"require-dev": {
6767
"ext-zip": "*",
6868
"ext-gd": "*",
69-
"phpunit/phpunit": "^4.8.36 || ^5.0",
69+
"phpunit/phpunit": "^4.8.36 || ^7.0",
7070
"squizlabs/php_codesniffer": "^2.9",
7171
"friendsofphp/php-cs-fixer": "^2.2",
7272
"phpmd/phpmd": "2.*",

src/PhpWord/Shared/Html.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static function addHtml($element, $html, $fullHTML = false, $preserveWhit
7171
}
7272

7373
// Load DOM
74+
libxml_disable_entity_loader(true);
7475
$dom = new \DOMDocument();
7576
$dom->preserveWhiteSpace = $preserveWhiteSpace;
7677
$dom->loadXML($html);

src/PhpWord/TemplateProcessor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public function __construct($documentTemplate)
113113
*/
114114
protected function transformSingleXml($xml, $xsltProcessor)
115115
{
116+
libxml_disable_entity_loader(true);
116117
$domDocument = new \DOMDocument();
117118
if (false === $domDocument->loadXML($xml)) {
118119
throw new Exception('Could not load the given XML document.');

tests/PhpWord/_includes/XmlDocument.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ public function getFileDom($file = 'word/document.xml')
7676
$this->file = $file;
7777

7878
$file = $this->path . '/' . $file;
79+
libxml_disable_entity_loader(false);
7980
$this->dom = new \DOMDocument();
8081
$this->dom->load($file);
82+
libxml_disable_entity_loader(true);
8183

8284
return $this->dom;
8385
}

0 commit comments

Comments
 (0)