mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Made mimetype check case insensitive.
This commit is contained in:
parent
2d10707d18
commit
9ae7f11a2a
2 changed files with 4 additions and 1 deletions
|
@ -2362,8 +2362,8 @@ class ValidationTest extends CakeTestCase {
|
||||||
$this->assertTrue(Validation::mimeType($image, array('image/gif')));
|
$this->assertTrue(Validation::mimeType($image, array('image/gif')));
|
||||||
$this->assertTrue(Validation::mimeType(array('tmp_name' => $image), array('image/gif')));
|
$this->assertTrue(Validation::mimeType(array('tmp_name' => $image), array('image/gif')));
|
||||||
$this->assertTrue(Validation::mimeType(array('tmp_name' => $image), '#image/.+#'));
|
$this->assertTrue(Validation::mimeType(array('tmp_name' => $image), '#image/.+#'));
|
||||||
|
$this->assertTrue(Validation::mimeType($image, array('image/GIF')));
|
||||||
|
|
||||||
$this->assertFalse(Validation::mimeType($image, array('image/GIF')));
|
|
||||||
$this->assertFalse(Validation::mimeType($image, array('image/png')));
|
$this->assertFalse(Validation::mimeType($image, array('image/png')));
|
||||||
$this->assertFalse(Validation::mimeType(array('tmp_name' => $image), array('image/png')));
|
$this->assertFalse(Validation::mimeType(array('tmp_name' => $image), array('image/png')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -948,6 +948,9 @@ class Validation {
|
||||||
return self::_check($mime, $mimeTypes);
|
return self::_check($mime, $mimeTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($mimeTypes as $key => $val) {
|
||||||
|
$mimeTypes[$key] = strtolower($val);
|
||||||
|
}
|
||||||
return in_array($mime, $mimeTypes);
|
return in_array($mime, $mimeTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue