Skip to content

Commit c3a1a66

Browse files
committed
Avoid deprecation warnings about libxml_disable_entity_loader in PHP 8.1
Signed-off-by: Côme Chilliet <[email protected]>
1 parent ec4fff2 commit c3a1a66

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

lib/private/Updater/ChangesCheck.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,13 @@ protected function queryChangesServer(string $uri, ChangesResult $entry): IRespo
138138
protected function extractData($body):array {
139139
$data = [];
140140
if ($body) {
141-
$loadEntities = libxml_disable_entity_loader(true);
142-
$xml = @simplexml_load_string($body);
143-
libxml_disable_entity_loader($loadEntities);
141+
if (\LIBXML_VERSION < 20900) {
142+
$loadEntities = libxml_disable_entity_loader(true);
143+
$xml = @simplexml_load_string($body);
144+
libxml_disable_entity_loader($loadEntities);
145+
} else {
146+
$xml = @simplexml_load_string($body);
147+
}
144148
if ($xml !== false) {
145149
$data['changelogURL'] = (string)$xml->changelog['href'];
146150
$data['whatsNew'] = [];

lib/private/Updater/VersionCheck.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@ public function check() {
9595
}
9696

9797
if ($xml) {
98-
$loadEntities = libxml_disable_entity_loader(true);
99-
$data = @simplexml_load_string($xml);
100-
libxml_disable_entity_loader($loadEntities);
98+
if (\LIBXML_VERSION < 20900) {
99+
$loadEntities = libxml_disable_entity_loader(true);
100+
$data = @simplexml_load_string($xml);
101+
libxml_disable_entity_loader($loadEntities);
102+
} else {
103+
$data = @simplexml_load_string($xml);
104+
}
101105
if ($data !== false) {
102106
$tmp['version'] = (string)$data->version;
103107
$tmp['versionstring'] = (string)$data->versionstring;

0 commit comments

Comments
 (0)