[PHP-CVS] [php-src] master: streams: tidy the wrapper error log when the opener succeeds (#22977)

[email protected] (Ilia Alshanetsky via GitHub) Mon, 3 Aug 2026 12:28:58 +0000
Newsgroups php.cvs
Message-ID <[email protected]>
Author: Ilia Alshanetsky (iliaal)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-08-03T13:28:55+01:00

Commit: https://github.com/php/php-src/commit/1f98ff9571c498148101338f5caa15784dd8dff7
Raw diff: https://github.com/php/php-src/commit/1f98ff9571c498148101338f5caa15784dd8dff7.diff

streams: tidy the wrapper error log when the opener succeeds (#22977)

Before the early-return refactor in d75f79e2acf the tidy call sat on the
single return path, so it ran whether or not the opener produced a stream.
It now runs only when the opener fails, so anything the opener stored while
REPORT_ERRORS was masked stays in FG(wrapper_logged_errors) until request
shutdown and is replayed by the next failure for the same wrapper.

Closes GH-22977

Changed paths:
  M  main/streams/streams.c


Diff:

diff --git a/main/streams/streams.c b/main/streams/streams.c
index cb75e322d928..a09a2180921d 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -2144,6 +2144,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
 		php_stream_tidy_wrapper_name_error_log(wrapper_name);
 		goto cleanup;
 	}
+	php_stream_tidy_wrapper_name_error_log(wrapper_name);
 
 	/* if the caller asked for a persistent stream but the wrapper did not
 	 * return one, force an error here */