Skip to content

Commit e60466d

Browse files
committed
fix: ErrorException is thrown if getimagesize() returns false
ErrorException Trying to access array offset on value of type bool
1 parent 9894b92 commit e60466d

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)