Skip to content

Split streams filter seekability into read and write fields#21878

Open
bukka wants to merge 1 commit intophp:masterfrom
bukka:stream_filter_write_seek
Open

Split streams filter seekability into read and write fields#21878
bukka wants to merge 1 commit intophp:masterfrom
bukka:stream_filter_write_seek

Conversation

@bukka
Copy link
Copy Markdown
Member

@bukka bukka commented Apr 26, 2026

The single seekable field caused write-chain seeks to reset filter state after the bug #49874 fix, breaking dechunk on php://temp (used by Symfony HttpClient).

Split into read_seekable and write_seekable. Write defaults to ALWAYS for stateless and non-buffering filters. Buffer-holding filters (zlib, bz2, convert.*) accept a write_seek_mode parameter: "preserve" (default), "reset", or "strict". Invalid values throw ValueError.

php_user_filter::seek gains a third int $chain argument; the ops seek signature is unchanged.

The single seekable field caused write-chain seeks to reset filter
state after the bug #49874 fix, breaking dechunk on php://temp (used
by Symfony HttpClient).

Split into read_seekable and write_seekable. Write defaults to ALWAYS
for stateless and non-buffering filters. Buffer-holding filters
(zlib, bz2, convert.*) accept a write_seek_mode parameter:
"preserve" (default), "reset", or "strict". Invalid values throw
ValueError.

php_user_filter::seek gains a third int $chain argument; the ops
seek signature is unchanged.
@bukka bukka force-pushed the stream_filter_write_seek branch from 1545a13 to 7aba509 Compare May 1, 2026 11:33

/** @tentative-return-type */
public function seek(int $offset, int $whence): bool {}
public function seek(int $offset, int $whence, int $chain): bool {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this has to be an optional arg to preserve BC

Copy link
Copy Markdown
Contributor

@nicolas-grekas nicolas-grekas May 6, 2026

Choose a reason for hiding this comment

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

hum, maybe I'm wrong in the sense that this isn't enforced? then maybe we should have a test that shows user-filters with no $chain still work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was introduced with that seek change and is present only in master so no BC break in any case... :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants