aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Updater
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2021-12-16 10:35:03 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2021-12-16 10:35:03 +0100
commitc3a1a66eaefac9e06385d125dd4edae3117cc9eb (patch)
treec0db4721028d4a1193140ec3d415be4b75621226 /lib/private/Updater
parentec4fff20e848840ceeceac269981b60d27ba9974 (diff)
downloadnextcloud-server-c3a1a66eaefac9e06385d125dd4edae3117cc9eb.tar.gz
nextcloud-server-c3a1a66eaefac9e06385d125dd4edae3117cc9eb.zip
Avoid deprecation warnings about libxml_disable_entity_loader in PHP 8.1
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Updater')
-rw-r--r--lib/private/Updater/ChangesCheck.php10
-rw-r--r--lib/private/Updater/VersionCheck.php10
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php
index 600c8db9a3c..e3ced6e5b12 100644
--- a/lib/private/Updater/ChangesCheck.php
+++ b/lib/private/Updater/ChangesCheck.php
@@ -138,9 +138,13 @@ class ChangesCheck {
protected function extractData($body):array {
$data = [];
if ($body) {
- $loadEntities = libxml_disable_entity_loader(true);
- $xml = @simplexml_load_string($body);
- libxml_disable_entity_loader($loadEntities);
+ if (\LIBXML_VERSION < 20900) {
+ $loadEntities = libxml_disable_entity_loader(true);
+ $xml = @simplexml_load_string($body);
+ libxml_disable_entity_loader($loadEntities);
+ } else {
+ $xml = @simplexml_load_string($body);
+ }
if ($xml !== false) {
$data['changelogURL'] = (string)$xml->changelog['href'];
$data['whatsNew'] = [];
diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php
index ffa707d8990..d9f795796b8 100644
--- a/lib/private/Updater/VersionCheck.php
+++ b/lib/private/Updater/VersionCheck.php
@@ -95,9 +95,13 @@ class VersionCheck {
}
if ($xml) {
- $loadEntities = libxml_disable_entity_loader(true);
- $data = @simplexml_load_string($xml);
- libxml_disable_entity_loader($loadEntities);
+ if (\LIBXML_VERSION < 20900) {
+ $loadEntities = libxml_disable_entity_loader(true);
+ $data = @simplexml_load_string($xml);
+ libxml_disable_entity_loader($loadEntities);
+ } else {
+ $data = @simplexml_load_string($xml);
+ }
if ($data !== false) {
$tmp['version'] = (string)$data->version;
$tmp['versionstring'] = (string)$data->versionstring;