Skip to content

DataPart::fromPath can cause a notice #32816

@connorhu

Description

@connorhu

Symfony version(s) affected: 4.3.3

Description
This mime type definition [0] cause notice (Notice: Undefined offset: 1) here [1] because of this [2].
[0]
https://github.com/symfony/mime/blob/e543521a5566dc2be7b675f50500f4ed8feadc60/MimeTypes.php#L2439
[1]
https://github.com/symfony/mime/blob/c71b839cc39d446f14afaef771c16f221d85c331/Part/DataPart.php#L38
[2]
https://github.com/symfony/mime/blob/c71b839cc39d446f14afaef771c16f221d85c331/Part/DataPart.php#L56

The auto mime type detection pick ups the first mime type without slash and the explode function results in a 1 item length array.
You can send the mime type on the 3rd argument, but i don't think this is a best solution.
We should do a better error reporting at the explode function.

How to reproduce
DataPart::fromPath('somefile.odt');

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy