Skip to content

TypeError on Shape\Drawing\File::getMimeType() #873

@nreynis

Description

@nreynis

I got the following stacktrace in a production environment:

TypeError: PhpOffice\PhpPresentation\Shape\Drawing\File::getMimeType(): Return value must be of type string, false returned
/vendor/phpoffice/phppresentation/src/PhpPresentation/Shape/Drawing/File.php:86 PhpOffice\PhpPresentation\Shape\Drawing\File::getMimeType
/vendor/phpoffice/phppresentation/src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php:134 PhpOffice\PhpPresentation\Writer\PowerPoint2007\ContentTypes::render
/vendor/phpoffice/phppresentation/src/PhpPresentation/Writer/PowerPoint2007.php:118 PhpOffice\PhpPresentation\Writer\PowerPoint2007::save

I didn't managed to reproduce the issue and I assume it might be a fringe issue with NFS synchronization.

However, this does not change the fact that mime_content_type might return false if anything goes wrong.
This code should either handle the error or turn it into a PhpPresentationException.
Having a TypeError is not desirable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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