Throwing an exception when loading a directory
This commit is contained in:
parent
49ae724e9c
commit
8b83b58aa5
@ -48,7 +48,7 @@ final class Dotenv
|
||||
{
|
||||
// func_get_args() to be replaced by a variadic argument for Symfony 4.0
|
||||
foreach (func_get_args() as $path) {
|
||||
if (!is_readable($path)) {
|
||||
if (!is_readable($path) || is_dir($path)) {
|
||||
throw new PathException($path);
|
||||
}
|
||||
|
||||
|
@ -145,4 +145,13 @@ class DotenvTest extends TestCase
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Dotenv\Exception\PathException
|
||||
*/
|
||||
public function testLoadDirectory()
|
||||
{
|
||||
$dotenv = new Dotenv();
|
||||
$dotenv->load(__DIR__);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user