Skip to content

phar: phar_stream_close silently discards phar_stream_flush failure #21799

@iliaal

Description

@iliaal

phar_stream_close in ext/phar/stream.c calls phar_stream_flush but discards its return value, always returning 0 (success) from fclose() even when the flush failed.

If phar_stream_flush encounters a write error (e.g. out of disk space while committing phar modifications), the application gets no indication of failure from fclose($fp).

Location: phar_stream_closephar_stream_flush(stream); return value is silently dropped.

Fix: capture the flush return value and return it from phar_stream_close.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions