Skip to content
Snippets Groups Projects
Unverified Commit fdd11192 authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by GitHub
Browse files

Merge pull request #25039 from nextcloud/fix/libxml-use-internal-errors-deprecated

Only use libxml_disable_entity_loader on php older than 8
parents a599a7d0 f8efab7c
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
namespace OC\App; namespace OC\App;
use OCP\ICache; use OCP\ICache;
use function libxml_disable_entity_loader;
use function simplexml_load_file;
class InfoParser { class InfoParser {
/** @var \OCP\ICache|null */ /** @var \OCP\ICache|null */
...@@ -61,10 +63,14 @@ class InfoParser { ...@@ -61,10 +63,14 @@ class InfoParser {
} }
libxml_use_internal_errors(true); libxml_use_internal_errors(true);
$loadEntities = libxml_disable_entity_loader(false); if ((PHP_VERSION_ID < 80000)) {
$xml = simplexml_load_file($file); $loadEntities = libxml_disable_entity_loader(false);
$xml = simplexml_load_file($file);
libxml_disable_entity_loader($loadEntities);
} else {
$xml = simplexml_load_file($file);
}
libxml_disable_entity_loader($loadEntities);
if ($xml === false) { if ($xml === false) {
libxml_clear_errors(); libxml_clear_errors();
return null; return null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment