[php-src] PR #25543: Fix GH-24256: fclose() returns false for stream wrappers without stream_flush()

From: Date: Tue, 17 Nov 2026 23:52:31 +0000
Subject: [php-src] PR #25543: Fix GH-24256: fclose() returns false for stream wrappers without stream_flush()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40758@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25543 Author: TiagoCruz1224 Since c07cc8502c (bug #60110), fclose(), file_put_contents() and copy() return the result of the flush on close. A user wrapper without stream_flush() makes that flush fail, so these functions return false although nothing failed. stream_flush() is optional, so when the stream is closed a missing one now counts as nothing to flush. An explicit fflush() still returns false for such a wrapper, and a stream_flush() that returns false still makes fclose() return false. This picks up #24259 by @lazerg, which was closed for inactivity, with the same fix and a test that also covers the explicit fflush() and a failing stream_flush(). Fixes #24256 I prepared this change with AI assistance, then reviewed it and verified each case myself.

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