Bug #78655 [Com]: Substitute character (^Z) in PDF breaks mime type detection

From: Date: Wed, 09 Oct 2019 12:00:51 +0000
Subject: Bug #78655 [Com]: Substitute character (^Z) in PDF breaks mime type detection
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223157@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78655&edit=1 ID: 78655 Comment by: leeuwd at me dot com Reported by: dick at tellow dot nl Summary: Substitute character (^Z) in PDF breaks mime type detection Status: Open Type: Bug Package: *General Issues Operating System: macOS 10.15 PHP Version: 7.1.32 Block user comment: N Private report: N New Comment: Substitute character (https://en.wikipedia.org/wiki/Substitute_character): "In Unix operating systems, this character is typically used to suspend the currently executing interactive process" Could be the culprit. Previous Comments: ------------------------------------------------------------------------ [2019-10-09 11:34:55] dick at tellow dot nl Description: ------------ Substitute character (^Z) in PDF breaks mime type detection. If the broken.pdf file contains: ``` %PDF-1.3^M$ %�����������^M$ 4 0 obj^M$ << /Length 2625 /Filter [ /FlateDecode ] >>^M$ stream^M$ x��^Z$ Ug�$ $ %%EOF$ ``` getting the MIME type via finfo or mime_content_type returns the incorrect 'application/octet-stream' instead of the expected 'application/pdf'. Problem occurs on localhost macOS and remote server running Linux. Test script: --------------- $finfo = new \finfo(FILEINFO_MIME_TYPE); var_dump($finfo->file('broken.pdf')); = string(24) "application/octet-stream" Expected result: ---------------- application/pdf Actual result: -------------- application/octet-stream ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78655&edit=1

« previous php.bugs (#223157) next »