[php-src] Issue #11456: finfo Returns Unexpected Mimetype for Some CAD Formats
| From: | falconsmilie | Date: | Thu, 15 Jun 2023 11:37:46 +0000 |
| Subject: | [php-src] Issue #11456: finfo Returns Unexpected Mimetype for Some CAD Formats | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244697@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11456
Author: falconsmilie
### Description
A couple of popular CAD file formats are returning unexpected results using
finfo().
[STL](https://en.wikipedia.org/wiki/STL_(file_format)) and
[STP/STEP](https://en.wikipedia.org/wiki/ISO_10303-21).
The following code:
```php
<?php
$path = dirname(__FILE__) . '/my.step';
$file = new \finfo(\FILEINFO_MIME_TYPE);
$step = $file->file($path);
$path = dirname(__FILE__) . '/my.stp';
$file = new \finfo(\FILEINFO_MIME_TYPE);
$stp = $file->file($path);
$path = dirname(__FILE__) . '/my.stl';
$file = new \finfo(\FILEINFO_MIME_TYPE);
$stl = $file->file($path);
echo $step;
echo $stp;
echo $stl;
```
Resulted in this output:
```
text/plain
text/plain
application/octet-stream
```
But I expected this output instead:
```
model/step
model/step
model/stl
```
Sorry, but Github won't allow attaching example files for STL or STEP.
### PHP Version
8.2.1
### Operating System
_No response_