Bug #78183 [NEW]: finfo_file shows wrong mime-type for .tga file

From: Date: Wed, 19 Jun 2019 15:51:03 +0000
Subject: Bug #78183 [NEW]: finfo_file shows wrong mime-type for .tga file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221396@lists.php.net to get a copy of this message
From:             dev at jdoubleu dot de
Operating system: Linux
PHP version:      7.2.19
Package:          Filesystem function related
Bug Type:         Bug
Bug description:finfo_file shows wrong mime-type for .tga file

Description:
------------
The finfo_file() method does not return the correct mime-type for .tga
files.

Test script:
---------------
ini_set('user_agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77
Safari/537.36');

$src = fopen('http://people.math.sc.edu/Burkardt/data/tga/earth.tga',
'r');
$dest = fopen('image.tga', 'w');
stream_copy_to_stream($src, $dest);

print(finfo_file(finfo_open(FILEINFO_MIME_TYPE), 'image.tga'));
// => image/x-tgaimage/x-tga

Expected result:
----------------
"image/x-tga"

Actual result:
--------------
"image/x-tgaimage/x-tga"

-- 
Edit bug report at https://bugs.php.net/bug.php?id=78183&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=78183&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=78183&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=78183&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=78183&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=78183&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=78183&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=78183&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=78183&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=78183&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=78183&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=78183&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=78183&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=78183&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78183&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=78183&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=78183&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=78183&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78183&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=78183&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=78183&r=mysqlcfg



Thread (9 messages)

« previous php.bugs (#221396) next »