]> source.dussan.org Git - nextcloud-server.git/commitdiff
Avoid deprecation warnings about libxml_disable_entity_loader in PHP 8.1 29862/head
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 16 Dec 2021 09:35:03 +0000 (10:35 +0100)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 16 Dec 2021 09:35:03 +0000 (10:35 +0100)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
lib/private/Updater/ChangesCheck.php
lib/private/Updater/VersionCheck.php

index 600c8db9a3c2c03643455a4e9c5864b98e53e659..e3ced6e5b123e5bf71d5d68c8184d3ce18c5e349 100644 (file)
@@ -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'] = [];
index ffa707d899093c57dcf7ac2a9750e49a2de459c1..d9f795796b8cef58aee42cdcaba31e290225c853 100644 (file)
@@ -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;