From a0949bc85e7a0659ed1bbbbececd2ccca374cc3c Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sat, 17 Feb 2024 23:26:26 +0100 Subject: [PATCH] fixed types --- src/Forms/Helpers.php | 2 +- src/Forms/Validator.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Forms/Helpers.php b/src/Forms/Helpers.php index d20eecad7..fcdb1d939 100644 --- a/src/Forms/Helpers.php +++ b/src/Forms/Helpers.php @@ -66,7 +66,7 @@ private static function sanitize(int $type, $value) { if ($type === Form::DataText) { return is_scalar($value) - ? Strings::normalizeNewLines($value) + ? Strings::normalizeNewLines((string) $value) : null; } elseif ($type === Form::DataLine) { diff --git a/src/Forms/Validator.php b/src/Forms/Validator.php index c56d84482..04a2c3f5a 100644 --- a/src/Forms/Validator.php +++ b/src/Forms/Validator.php @@ -381,7 +381,7 @@ public static function validateMimeType(Controls\UploadControl $control, $mimeTy { $mimeTypes = is_array($mimeType) ? $mimeType : explode(',', $mimeType); foreach (static::toArray($control->getValue()) as $file) { - $type = strtolower($file->getContentType()); + $type = strtolower($file->getContentType() ?? ''); if (!in_array($type, $mimeTypes, true) && !in_array(preg_replace('#/.*#', '/*', $type), $mimeTypes, true)) { return false; }