Skip to content

bugfix: keep final event when non-seekable event stream reaches EOF - #3375

Open
lazerg wants to merge 1 commit into
aws:masterfrom
lazerg:bugfix-eventstream-final-event-eof
Open

lazerg wants to merge 1 commit into
aws:masterfrom
lazerg:bugfix-eventstream-final-event-eof

Conversation

@lazerg

@lazerg lazerg commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available:
closes #3374

Description of changes:
NonSeekableStreamDecodingEventStreamIterator decided valid() from $stream->eof(), which is checked after the current event has already been parsed. Streams like BufferStream report EOF as soon as the last byte is read, so the last complete event was dropped (and a single-event stream returned nothing). php://temp bodies only hit EOF on the next read, which is why the existing tests didn't catch it. Now next() clears the current event once the stream is exhausted, and valid() checks whether there is an event to return.

Generated by AI tools, and reviewed by @lazerg.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@lazerg
lazerg requested a review from a team as a code owner October 14, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Event stream decoder drops the final event when reading it reaches EOF

1 participant