Bug #55691 [Com]: different results from finfo_file and finfo_buffer
Edit report at https://bugs.php.net/bug.php?id=55691&edit=1
ID: 55691
Comment by: chealer at gmail dot com
Reported by: di_herbert dot huber at yahoo dot com
Summary: different results from finfo_file and finfo_buffer
Status: No Feedback
Type: Bug
Package: Filesystem function related
Operating System: WinXP HE SP2
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
In my case too, finfo_file()'s result is superior.
Thanks for reopening
Previous Comments:
------------------------------------------------------------------------
[2017-08-29 15:37:54] chealer at gmail dot com
Thanks to Magnar for pointing me here. I reported another variant on Stack Overflow: https://stackoverflow.com/questions/45243973/fileinfo-finfo-buffer-results-differ-from-finfo-file?noredirect=1
My problem also happens with Microsoft Office files, but in my case, the types are
application/CDFV2-corrupt vs application/msword.
------------------------------------------------------------------------
[2017-08-28 11:43:02] magnar at myrtveit dot com
To reproduce this bug:
Download for example the file http://opendatakit.org/wp-content/uploads/static/sample.xls
Run the following code:
<?php
// Change $FilePath to wherever you stored the downloaded file
$FilePath = 'C:/sample.xls';
$Info = new finfo(FILEINFO_MIME_TYPE);
echo $Info->file($FilePath);
echo ' != ';
echo $Info->buffer(file_get_contents($FilePath));
?>
The output will be:
application/vnd.ms-excel != application/octet-stream
Tested with PHP 7.1 on Windows 10.
------------------------------------------------------------------------
[2015-09-13 04:22:21] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
------------------------------------------------------------------------
[2015-08-31 18:05:50] cmb@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2011-09-17 07:44:26] thomas at partyflock dot nl
Happens to me too, and I experience this for an xls/Excel document too.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=55691
--
Edit this bug report at https://bugs.php.net/bug.php?id=55691&edit=1
Thread (7 messages)