Skip to content

streams: tidy the wrapper error log on every open_wrapper return - #22977

Open
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/streams-tidy-wrapper-log-on-cleanup
Open

streams: tidy the wrapper error log on every open_wrapper return#22977
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/streams-tidy-wrapper-log-on-cleanup

Conversation

@iliaal

@iliaal iliaal commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Until d75f79e the tidy call sat on the single return path of _php_stream_open_wrapper_ex(), so it ran whether or not the opener produced a stream. The early-return refactor duplicated it into the three failure branches, and 605ff6e then folded those into a shared cleanup: while keeping only the copy in the opener-failure branch. Openers run with REPORT_ERRORS masked and store into FG(wrapper_logged_errors) instead of printing, so anything stored by an opener that goes on to succeed now survives until request shutdown and is replayed by the next failure for the same wrapper.

I could not build a userland reproducer: every built-in opener that stores a message returns NULL right after, and instrumenting the shared cleanup produced no hit across the test suite. The invariant is still that the list only holds messages for an open that is in flight, so this restores it rather than fixing an observable symptom.

@iliaal
iliaal requested a review from bukka as a code owner July 31, 2026 15:10
iliaal added a commit to iliaal/php-src that referenced this pull request Jul 31, 2026
Before the early-return refactor in d75f79e 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 phpGH-22977
@iliaal
iliaal force-pushed the fix/streams-tidy-wrapper-log-on-cleanup branch from 9b01ee6 to a7cb75d Compare July 31, 2026 15:10
@iliaal
iliaal requested a review from Girgias July 31, 2026 16:08

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see why it needs to be at the end? But if you want it to be called regardless I would prefer for it to added after the UNEXPECTED(!stream) branch as no other messages will be added to the log.

Before the early-return refactor in d75f79e 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 phpGH-22977
@iliaal
iliaal force-pushed the fix/streams-tidy-wrapper-log-on-cleanup branch from a7cb75d to dcf5a1f Compare July 31, 2026 17:23
@iliaal

iliaal commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

It doesn't, cleanup: was just the one point every post-opener return passes through. Added after the branch instead.

@iliaal
iliaal requested a review from Girgias July 31, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants