Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
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 Jun 28, 2022
commit ec7c8e8cc16cfc29773c8aa918a0f0a59bbad716
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