From 2f292c247eef1b47dd6d2abc7760ab8a515470d9 Mon Sep 17 00:00:00 2001 From: Oleg Andreyev Date: Thu, 31 Aug 2017 12:18:43 +0300 Subject: [PATCH] #24046 added check for ext-dom to XmlUtil::loadFile --- src/Symfony/Component/Config/Util/XmlUtils.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index 25d9b0a0ab..0f16fc080b 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -37,9 +37,14 @@ class XmlUtils * @return \DOMDocument * * @throws \InvalidArgumentException When loading of XML file returns error + * @throws \RuntimeException When DOM extension is missing */ public static function loadFile($file, $schemaOrCallable = null) { + if (!extension_loaded('dom')) { + throw new \RuntimeException('Extension DOM is required.'); + } + $content = @file_get_contents($file); if ('' === trim($content)) { throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file));