改进文件上传的非法图像异常

This commit is contained in:
thinkphp
2017-09-12 14:55:12 +08:00
parent d1a99bb02c
commit 5a74ffca25
2 changed files with 12 additions and 4 deletions

View File

@@ -633,8 +633,12 @@ class Validate
if (function_exists('exif_imagetype')) {
return exif_imagetype($image);
} else {
$info = getimagesize($image);
return $info[2];
try {
$info = getimagesize($image);
return $info ? $info[2] : false;
} catch (\Exception $e) {
return false;
}
}
}