Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Illuminate/Validation/Concerns/ValidatesAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ protected function validateDigitsBetween($attribute, $value, $parameters)
*/
protected function validateDimensions($attribute, $value, $parameters)
{
if (! $this->isValidFileInstance($value) || ! $sizeDetails = getimagesize($value->getRealPath())) {
if (! $this->isValidFileInstance($value) || ! $sizeDetails = @getimagesize($value->getRealPath())) {
return false;
}

Expand Down
7 changes: 7 additions & 0 deletions tests/Validation/ValidationValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,13 @@ public function testValidateImageDimensions()

$v = new Validator($trans, ['x' => $uploadedFile], ['x' => 'dimensions:ratio=1']);
$this->assertTrue($v->fails());

// This test fails without suppressing warnings on getimagesize() due to a read error.
$emptyUploadedFile = new \Symfony\Component\HttpFoundation\File\UploadedFile(__DIR__.'/fixtures/empty.gif', '', null, null, null, true);
$trans = $this->getIlluminateArrayTranslator();

$v = new Validator($trans, ['x' => $emptyUploadedFile], ['x' => 'dimensions:min_width=1']);
$this->assertTrue($v->fails());
}

/**
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.