Bug #79764 [NEW]: finfo::file returns text/plain mime type when JSON contains empty arrays
| From: | edi dot modric at gmail dot com | Date: | Wed, 01 Jul 2020 12:26:33 +0000 |
| Subject: | Bug #79764 [NEW]: finfo::file returns text/plain mime type when JSON contains empty arrays | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-227756@lists.php.net to get a copy of this message | ||
From: edi dot modric at gmail dot com
Operating system: Ubuntu 20.04
PHP version: 7.4.7
Package: Filesystem function related
Bug Type: Bug
Bug description:finfo::file returns text/plain mime type when JSON contains empty arrays
Description:
------------
Using the following JSON document:
{
"foo": []
}
finfo::file method wrongly returns text/plain as mime type instead of
application/json.
Modifying the JSON document to e.g.:
{
"foo": ["bar"]
}
makes the function behave correctly and returns application/json.
Test script:
---------------
<?php
$finfo = new finfo(FILEINFO_MIME_TYPE);
echo $finfo->file('file.json') . PHP_EOL;
Expected result:
----------------
With the following content of file.json:
{
"foo": []
}
I expect to see "application/json" as the output.
Actual result:
--------------
With the following content of file.json:
{
"foo": []
}
"text/plain" is returned.
--
Edit bug report at https://bugs.php.net/bug.php?id=79764&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79764&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79764&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79764&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79764&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79764&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79764&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79764&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79764&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79764&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79764&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79764&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79764&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79764&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79764&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79764&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79764&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79764&r=mysqlcfg