[php-src] Issue #21799: phar: phar_stream_close silently discards phar_stream_flush failure
| From: | iliaal | Date: | Sat, 18 Apr 2026 13:06:16 +0000 |
| Subject: | [php-src] Issue #21799: phar: phar_stream_close silently discards phar_stream_flush failure | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251986@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/21799
Author: 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_close — phar_stream_flush(stream); return value is
silently dropped.
Fix: capture the flush return value and return it from phar_stream_close.