From 2fbf631384fd8cded55f4500cb87b129442f9ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 7 Nov 2011 15:18:10 +0100 Subject: [PATCH] Disable XML loading plugins on old PHP When libxml_disable_entity_loader is not available, we can not guarantee safe handling of XML data. --- libraries/import/ods.php | 11 ++++++++--- libraries/import/xml.php | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/libraries/import/ods.php b/libraries/import/ods.php index f0a57fcf7..dcc6a5153 100644 --- a/libraries/import/ods.php +++ b/libraries/import/ods.php @@ -13,6 +13,13 @@ if (! defined('PHPMYADMIN')) { exit; } +/** + * We need way to disable external XML entities processing. + */ +if (!function_exists('libxml_disable_entity_loader')) { + return; +} + /** * The possible scopes for $plugin_param are: 'table', 'database', and 'server' */ @@ -64,9 +71,7 @@ unset($data); /** * Disable loading of external XML entities. */ -if (function_exists('libxml_disable_entity_loader')) { - libxml_disable_entity_loader(); -} +libxml_disable_entity_loader(); /** * Load the XML string diff --git a/libraries/import/xml.php b/libraries/import/xml.php index f966a3f2c..9298225dd 100644 --- a/libraries/import/xml.php +++ b/libraries/import/xml.php @@ -12,6 +12,13 @@ if (! defined('PHPMYADMIN')) { exit; } +/** + * We need way to disable external XML entities processing. + */ +if (!function_exists('libxml_disable_entity_loader')) { + return; +} + /** * The possible scopes for $plugin_param are: 'table', 'database', and 'server' */ @@ -59,9 +66,7 @@ unset($data); /** * Disable loading of external XML entities. */ -if (function_exists('libxml_disable_entity_loader')) { - libxml_disable_entity_loader(); -} +libxml_disable_entity_loader(); /** * Load the XML string