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

From: Date: Wed, 09 Oct 2019 11:34:56 +0000
Subject: Bug #78655 [NEW]: Substitute character (^Z) in PDF breaks mime type detection
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223155@lists.php.net to get a copy of this message
From: dick at tellow dot nl Operating system: macOS 10.15 PHP version: 7.1.32 Package: *General Issues Bug Type: Bug Bug description:Substitute character (^Z) in PDF breaks mime type detection 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 bug report at https://bugs.php.net/bug.php?id=78655&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78655&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78655&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78655&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78655&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78655&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78655&r=support Expected behavior: https://bugs.php.net/fix.php?id=78655&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78655&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78655&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78655&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78655&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78655&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78655&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78655&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78655&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78655&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78655&r=mysqlcfg

« previous php.bugs (#223155) next »