Commit ed6be57e91e for php
commit ed6be57e91eeaaf82e716df6e8761ae2589020fa
Merge: 9892b3dde18 4476da4fda8
Author: David Carlier <devnexen@gmail.com>
Date: Thu Nov 26 19:02:19 2026 +0000
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
ext/zlib: fix gzwrite() not reporting write errors
# Conflicts:
# ext/zlib/zlib_fopen_wrapper.c
diff --cc ext/zlib/zlib_fopen_wrapper.c
index 7420c0cc6ff,a30ae2fa169..b192320d611
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.c
@@@ -86,9 -73,19 +86,15 @@@ static ssize_t php_gziop_write(php_stre
int written = gzwrite(self->gz_file, buf, chunk_size);
count -= chunk_size;
- if (UNEXPECTED(written < 0)) {
- php_gziop_report_errors(stream, chunk_size, "Write");
- return written;
+ if (UNEXPECTED(written <= 0)) {
+ int error = Z_OK;
+
+ gzerror(self->gz_file, &error);
+ if (error != Z_OK && total_written == 0) {
- if (error == Z_ERRNO && !(stream->flags & PHP_STREAM_FLAG_SUPPRESS_ERRORS)) {
- char errstr[256];
- php_error_docref(NULL, E_NOTICE, "Write of %u bytes failed with errno=%d %s",
- chunk_size, errno, php_socket_strerror_s(errno, errstr, sizeof(errstr)));
- }
++ php_gziop_report_errors(stream, chunk_size, "Write");
+ return -1;
+ }
+ return total_written;
}
total_written += written;