-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
BugDXDX = Developer eXperience (anything that improves the experience of using Symfony)DX = Developer eXperience (anything that improves the experience of using Symfony)DependencyInjection
Description
Today we debugged an error message coming from XmlFileLoader
in the DI component:
File some.xml does not contain valid XML, it is empty.
Coming from
symfony/src/Symfony/Component/Config/Util/XmlUtils.php
Lines 125 to 128 in 421c7f8
$content = @file_get_contents($file); | |
if ('' === trim($content)) { | |
throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file)); | |
} |
The file is not empty :) removing the @
reveals the true error:
PHP Warning: file_get_contents(file.ext): failed to open stream: Permission denied
So if $content
is false (before trim casts to string) we cant assume an empty file. Ideally the original errors bubbles up.
Metadata
Metadata
Assignees
Labels
BugDXDX = Developer eXperience (anything that improves the experience of using Symfony)DX = Developer eXperience (anything that improves the experience of using Symfony)DependencyInjection