I have a simple validator for image file input which looks like:
public function rules()
{
return [
['thumbnail', 'image', 'minWidth' => 800],
];
}
But as I try to send txt file it does not show error message but ImageValidator throws me an error: PHP Notice – yii\base\ErrorException ## getimagesize(): Read error!
protected function validateImage($image)
{
if (false === ($imageInfo = getimagesize($image->tempName))) {
return [$this->notImage, ['file' => $image->name]];
}
...
Why this happened? Why it does not stop on image rule why it test getimagesize() if it is not image file?