php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80476 Asking for new feature : SplFileInfo->getMIMEType()
Submitted: 2020-12-03 07:02 UTC Modified: 2021-10-07 10:26 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rdefaux at gmail dot com Assigned:
Status: Suspended Package: Filesystem function related
PHP Version: 7.4.13 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 - 5 = ?
Subscribe to this entry?

 
 [2020-12-03 07:02 UTC] rdefaux at gmail dot com
Description:
------------
Hello,

It would be nice if the class SplFileInfo had the method
getMIMEType() : string|false
This method would return a string representing the MIME type (same result as mime_content_type ( resource|string $filename ) function), or false if the file doesn't exists or is not a file (I mean is a dir, a symlink, etc...)

Thanks
Romaric
PS : it is the first time I ask for a request, I hope I'm doing it in a proper way.
And thanks a lot too to all the PHP team for its wonderful work ! :)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-03 10:28 UTC] rtrtrtrtrt at dfdfdfdf dot dfd
not possible, that's the "fileinfo" extensions job and the large mimemagic database mustn't be mandatory for spl-functions

https://www.php.net/manual/en/book.fileinfo.php
https://www.php.net/manual/en/function.mime-content-type.php


-rwxr-xr-x 1 root root 5,5M 2020-11-26 08:36 /usr/lib64/php/modules/fileinfo.so
 [2021-10-07 10:26 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2021-10-07 10:26 UTC] cmb@php.net
Yes, there would be a dependency issue.  SPL is always available,
while fileinfo may not.  How should the method behave in that
case?  Should it even be defined?  These details would need to be
figured out carefully, what demands an RFC.  Anybody who is
interested in that feature is welcome to pursue the RFC
process[1].  For the time being, I suspend this ticket.

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC