Skip to content

ZipArchive function getFromIndex() returns exception on archive with empty file #450

Open
@OskarsOzols

Description

@OskarsOzols

If the zip archive contains an empty file, the getFromIndex() function in the safe library throws an exception.

Exception message states "Failed to extract file from the zip archive: No error".

Native ZipArchive has this error code
[ZipArchive::ER_OK](https://www.php.net/manual/en/zip.constants.php#ziparchive.constants.er-ok) ([int](https://www.php.net/manual/en/language.types.integer.php)) No error.

This behavior is a flawed design in PHP, where an "error" message is generated despite there being no actual error. This could potentially be addressed and handled in the safe library to prevent the exception from being thrown in such cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions