Skip to content

Commit

Permalink
Modifications after review
Browse files Browse the repository at this point in the history
  • Loading branch information
przemyslaw-bogusz committed Mar 6, 2020
1 parent cd61555 commit d8bae7b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
Expand Up @@ -38,8 +38,8 @@ public function testLoadFile()
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported on Windows');
}
chmod($fixtures.'test.xml', 000);
XmlUtils::loadFile($fixtures.'test.xml');
chmod($fixtures.'not_readable.xml', 000);
XmlUtils::loadFile($fixtures.'not_readable.xml');
$this->fail();
} catch (\InvalidArgumentException $e) {
$this->assertStringContainsString('is not readable', $e->getMessage());
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Config/Util/XmlUtils.php
Expand Up @@ -123,17 +123,17 @@ public static function parse($content, $schemaOrCallable = null)
public static function loadFile($file, $schemaOrCallable = null)
{
if (!is_file($file)) {
throw new \InvalidArgumentException(sprintf('Resource %s is not a file.', $file));
throw new \InvalidArgumentException(sprintf('Resource "%s" is not a file.', $file));
}

if (!is_readable($file)) {
throw new \InvalidArgumentException(sprintf('File %s is not readable.', $file));
throw new \InvalidArgumentException(sprintf('File "%s" is not readable.', $file));
}

$content = file_get_contents($file);
$content = @file_get_contents($file);

if ('' === trim($content)) {
throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file));
throw new \InvalidArgumentException(sprintf('File "%s" does not contain valid XML, it is empty.', $file));
}

try {
Expand Down

0 comments on commit d8bae7b

Please sign in to comment.