Skip to content

fileinfo returns text/xml for some svg files #11891

Description

@ostrolucky

Description

The following code:

<?php
echo (new \finfo(\FILEINFO_MIME_TYPE))->file('svgfile.svg');

Resulted in this output:

text/xml

But I expected this output instead:

image/svg+xml

Here are example files:
logo_beta
Logo_SMC

I've reported same bug for file command line utility and they fixed it quickly: https://bugs.astron.com/view.php?id=470 (but I don't know how does the fix look like, I failed finding source code for their HEAD version)

PHP Version

8.2.8

Operating System

MacOS, Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions