Open Polkurier opened 3 years ago
I have some vague recollection of ext-exif issues with certain jpegs but can't recall the details at the moment.
I dig a bit and it seems to be bug in https://github.com/file/file (as discussed here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928009). I don't think we can do anything here apart from not returning bool.
i got the same problem, a null getFileinfo makes an error 500.
I changed the return type in this way, although It's not so clean..
public function getFileInfo($fileinfo_const = FILEINFO_NONE): string
{
if ((FILEINFO_MIME == $fileinfo_const) and (false != $this->mimeType)) {
return $this->mimeType;
}
$finfo = new finfo($fileinfo_const);
if (!($ftype = $finfo->buffer($this->getContents()))) {
$ftype = 'unknown';
}
return $ftype;
}
Does this issue still exist with the latest release?
Just got this issue today in a prod environment with php-imap 4.5.1 and php 7.3:
[2022-03-24T14:16:14.962500+00:00] app.INFO: ErrorException: Warning: finfo::buffer(): Failed identify data 0:JPEG image data, JFIF standard 1.01, resolution (DPI), density 300x300, segment length 16, Exif Standard: [TIFF image data
, big-endian, direntries=7, orientation=upper-left, xresolution=98, yresolution=106, resolutionunit=2, software=Adobe Photoshop CS2 Macintosh, datetime=2012:02:10 11:36:42]name use count (30) exceeded
Thanks for the info!
Just got this issue today too in a prod environment with php-imap 4.5.3 and php 7.3:
Same issue here with php-imap 4.5.2 and php 7.3.
@Sebi94nbg Same issue version 5.0.0, PHP 7.4.28
Warning: finfo::buffer(): Failed identify data 0:JPEG image data, JFIF standard 1.01, resolution (DPI), density 300x300, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=4]name use count (30) exceeded
In fact, the message above is a warning. The error in production is
Uncaught PHP Exception TypeError: "Return value of PhpImap\IncomingMailAttachment::getFileInfo() must be of the type string, bool returned"
Thanks for the feedback and information. I'll try to reproduce and fix it.
Environment (please complete the following information):
Describe the bug
While trying to get mime type of attached file we got warning:
This resulted in fatal error:
The used code:
The headers of the parsed email, if required and possible (only, if it's NOT confidential):