Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Avoid deprecation warnings about libxml_disable_entity_loader in PHP 8.1
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Dec 16, 2021
commit c3a1a66eaefac9e06385d125dd4edae3117cc9eb
10 changes: 7 additions & 3 deletions lib/private/Updater/ChangesCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,13 @@ protected function queryChangesServer(string $uri, ChangesResult $entry): IRespo
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'] = [];
Expand Down
10 changes: 7 additions & 3 deletions lib/private/Updater/VersionCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,13 @@ public function check() {
}

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;
Expand Down