Skip to content

Commit 00c2ab9

Browse files
authored
Merge pull request #8592 from kenjis/fix-ErrorException-FileRules
fix: [Validation] FileRules cause error if getimagesize() returns false
2 parents efb3816 + e60466d commit 00c2ab9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

system/Validation/FileRules.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,13 @@ public function max_dims(?string $blank, string $params): bool
242242
$allowedHeight = $params[1] ?? 0;
243243

244244
// Get uploaded image size
245-
$info = getimagesize($file->getTempName());
245+
$info = getimagesize($file->getTempName());
246+
247+
if ($info === false) {
248+
// Cannot get the image size.
249+
return false;
250+
}
251+
246252
$fileWidth = $info[0];
247253
$fileHeight = $info[1];
248254

0 commit comments

Comments
 (0)