Merge pull request #685 from MrPetovan/bug/5470-fix-various-notices

[twitter] Fix Read Error with exif_imagetype()
pull/687/head
Michael Vogel 2018-08-06 01:17:29 +02:00 committed by GitHub
commit 37312af8ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -1183,7 +1183,14 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
$tempfile = tempnam(get_temppath(), "cache");
file_put_contents($tempfile, $img_str);
$mime = image_type_to_mime_type(exif_imagetype($tempfile));
// See http://php.net/manual/en/function.exif-imagetype.php#79283
if (filesize($tempfile) > 11) {
$mime = image_type_to_mime_type(exif_imagetype($tempfile));
} else {
$mime = false;
}
unlink($tempfile);
if (substr($mime, 0, 6) == "image/") {