[php-src] PR #25697: Fix gzwrite() not reporting write errors

From: Date: Tue, 24 Nov 2026 09:21:52 +0000
Subject: [php-src] PR #25697: Fix gzwrite() not reporting write errors
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40944@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25697 Author: lacatoire gzwrite() and fwrite() on a compress.zlib:// stream reported success with 0 bytes when zlib failed to write (full disk, I/O error): the stream wrapper tested for a negative return, but gzwrite() returns 0 on error. The error is now reported when zlib sets Z_ERRNO, so the write returns false with a notice. A plain 0 on a stream opened for reading is unchanged. To reproduce: ```php <?php $data = random_bytes(300000); $w = gzopen('/dev/full', 'w'); var_dump(gzwrite($w, $data)); $f = fopen('compress.zlib:///dev/full', 'w'); var_dump(fwrite($f, $data)); ``` Before (8.4.26 and 8.5.11): ``` int(0) int(0) ``` After: ``` Notice: gzwrite(): Write of 300000 bytes failed with errno=28 No space left on device in ... on line 4 bool(false) Notice: fwrite(): Write of 300000 bytes failed with errno=28 No space left on device in ... on line 6 bool(false) ```

« previous php.git-pulls (#40944) next »