10000 #24046 added check for ext-dom to XmlUtil::loadFile · symfony/symfony@6e18095 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6e18095

Browse files
committed
#24046 added check for ext-dom to XmlUtil::loadFile
1 parent edb8c33 commit 6e18095

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/Config/Util/XmlUtils.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ private function __construct()
3737
* @return \DOMDocument
3838
*
3939
* @throws \InvalidArgumentException When loading of XML file returns error
40+
* @throws \RuntimeException When DOM extension is missing
4041
*/
4142
public static function loadFile($file, $schemaOrCallable = null)
4243
{
44+
if (!extension_loaded('dom')) {
45+
throw new \RuntimeException('Extension DOM is required.');
46+
}
47+
4348
$content = @file_get_contents($file);
4449
if ('' === trim($content)) {
4550
throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file));

0 commit comments

Comments
 (0)
0