mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 16:24:03 +00:00
Disallow empty strings as filenames
This commit is contained in:
parent
f3836cc623
commit
2bdda23a56
1 changed files with 10 additions and 2 deletions
|
|
@ -111,8 +111,16 @@ trait ValidatesDatabaseParameters
|
||||||
{
|
{
|
||||||
$this->validateParameter($filename, static::allowedFilenameCharacters());
|
$this->validateParameter($filename, static::allowedFilenameCharacters());
|
||||||
|
|
||||||
if (is_string($filename) && is_dir($filename)) {
|
if (! is_string($filename)) {
|
||||||
throw new InvalidArgumentException("Filename '{$filename}' is a directory.");
|
throw new InvalidArgumentException("Filename has to be a string.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filename === '') {
|
||||||
|
throw new InvalidArgumentException("Filename cannot be empty.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_dir($filename)) {
|
||||||
|
throw new InvalidArgumentException("Filename ('{$filename}') cannot be a directory.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue