Skip to content

Stream filter seeking#19981

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

Stream filter seeking#19981
bukka wants to merge 1 commit intophp:masterfrom
bukka:stream_filter_seeking

Conversation

@bukka
Copy link
Copy Markdown
Member

@bukka bukka commented Sep 27, 2025

Currently filter seeking does not work correctly for most streams. The idea is to extend API to allow seeking for some streams. There are couple of cases:

  • filter is always seekable - e.g. string.rot13, string.toupper, string.tolower
  • filter is seekable only when sought to start or when it re-run the data from the start (it means when there is some data buffered) - this is for pretty much all other filters that keep some state.
  • user filters are seekable by default for BC reason but if new seek method is implemented, then it is called and based on the bool result the seeking either fails or succeed.

The seeking to zero is implemented by resetting the internal state.

Fixes https://bugs.php.net/bug.php?id=49874

@bukka
Copy link
Copy Markdown
Member Author

bukka commented Sep 27, 2025

Just to note that the current implementation is just an API draft that is not really tested. It's also does not handle the buffered procession and no current filter implements it. Also it will need proper tests.

@bukka
Copy link
Copy Markdown
Member Author

bukka commented Nov 24, 2025

This is now ready for review.

@bukka bukka requested a review from ndossche November 24, 2025 22:02
@bukka
Copy link
Copy Markdown
Member Author

bukka commented Jan 1, 2026

This is just a heads up that I plan to merge it tomorrow unless someone wants more time for review or finds anything that needs to be addressed. Of course, I'm happy to address any potentially issue even if found after merging. I just don't want to wait for review forever as this needs to get merged (part of my stream work)...

Copy link
Copy Markdown
Member

@ndossche ndossche left a comment

Choose a reason for hiding this comment

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

Cursory look

@bukka bukka force-pushed the stream_filter_seeking branch from 73bcbd9 to f6f6152 Compare January 2, 2026 13:46
@bukka
Copy link
Copy Markdown
Member Author

bukka commented Jan 2, 2026

@ndossche Thanks a lot for the review. Hopefully all comments addressed.

Copy link
Copy Markdown
Member

@ndossche ndossche left a comment

Choose a reason for hiding this comment

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

Some nits

@bukka bukka force-pushed the stream_filter_seeking branch from 4d5362e to 77392ee Compare March 29, 2026 18:42
…ilters

Currently filter seeking does not work correctly for most streams. The
idea is to extend API to allow seeking for some streams. There are
couple of cases:

- filter is always seekable - e.g. string.rot13, string.toupper,
  string.tolower
- filter is seekable only when sought to start or when it re-run the
  data from the start (it means when there is some data buffered) -
  this is for pretty much all other filters that keep some state.
- user filters are seekable by default for BC reason but if new
  seek method is implemented, then it is called and based on the
  bool result the seeking either fails or succeed.
@bukka bukka force-pushed the stream_filter_seeking branch from 77392ee to 48a7181 Compare March 29, 2026 20:23
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