Skip to content

Commit 681d5c4

Browse files
committed
fix PHP 8.0 compatibility
1 parent 67b1598 commit 681d5c4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/PhpWord/Shared/XMLReader.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@ public function getDomFromZip($zipFile, $xmlFile)
7272
*/
7373
public function getDomFromString($content)
7474
{
75-
$originalLibXMLEntityValue = libxml_disable_entity_loader(true);
75+
if (\PHP_VERSION_ID < 80000) {
76+
$originalLibXMLEntityValue = libxml_disable_entity_loader(true);
77+
}
7678
$this->dom = new \DOMDocument();
7779
$this->dom->loadXML($content);
78-
libxml_disable_entity_loader($originalLibXMLEntityValue);
80+
if (\PHP_VERSION_ID < 80000) {
81+
libxml_disable_entity_loader($originalLibXMLEntityValue);
82+
}
7983

8084
return $this->dom;
8185
}

tests/PhpWord/Shared/XMLWriterTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public function testWriteAttributeShouldWriteFloatValueLocaleIndependent()
6666

6767
setlocale(LC_NUMERIC, 'de_DE.UTF-8', 'de');
6868

69-
$this->assertSame('1,2', (string)$value);
7069
$this->assertSame('<element name="1.2"/>' . chr(10), $xmlWriter->getData());
7170

7271
setlocale(LC_NUMERIC, $currentLocale);

0 commit comments

Comments
 (0)