1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 21:44:06 +00:00

Disallow empty strings as filenames

This commit is contained in:
lukinovec 2026-05-01 10:37:22 +02:00
parent f3836cc623
commit 2bdda23a56

View file

@ -111,8 +111,16 @@ trait ValidatesDatabaseParameters
{
$this->validateParameter($filename, static::allowedFilenameCharacters());
if (is_string($filename) && is_dir($filename)) {
throw new InvalidArgumentException("Filename '{$filename}' is a directory.");
if (! is_string($filename)) {
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.");
}
}
}