-
Notifications
You must be signed in to change notification settings - Fork 7.8k
ftp cannot be rewound #11597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What ftp wrapper does is sending https://github.com/php/php-src/blob/master/ext/standard/ftp_fopen_wrapper.c#L724 |
As any file iterator is not buffered, ie. the results will change if the filesystem changes, there is no reason to not rewind the ftp iterator as well. Basically a rewind operation imply the state after an iterator is created. |
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Finder] Fix initial directory is opened twice | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #50851 | License | MIT | Doc PR | no The issue was introduced in #8120 which was coded wrongly for several reasons: - `seekable` support is about file/stream content seeking, not about rewind support, non-seekable stream handler can support rewind - it worked by coincidence - the original code involved additional directory open (syscall), which is/was slow - 1st rewind of DirectoryIterator is implicit, ie. it is not needed - again, skipping the rewind worked by coincidence - 2nd+ rewind must fail if it is not supported, the original code silently skipped it The test from #8120 is kept and is passing. I also improved the ftp support detection to make the test stricter. To support rewind for ftp I opened - php/php-src#11597 - but this Symfony PR does not need it. Commits ------- d3f03be [Finder] Fix initial directory is opened twice
Rewinding is implemented as seeking back to position 0. The entry for seek in |
Description
The following code:
Resulted in this output:
Warning: FilesystemIterator::rewind(): stream does not support seeking
But I expected this output instead:
support should not be related with seeking support
PHP Version
any
Operating System
any
The text was updated successfully, but these errors were encountered: