[WIP] add support to open vfs streams with compress.zlib://vfs://path/to/file.txt #125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support to open vfs streams using
compress.zlib://
as a prefix as described in #121.However, it involves writing to disk as the vfsStream wrapper must return a file resource on itsstream_cast
method. I tried usingphp://memory
first, but this resulted in a similar error message. Writing to the real file system kind of defeats the purpose of vfsStream of having no file system interaction at all. However, vfsStream could take care of removing such temporary files on its own (not implemented yet), so for the user there would be no difference at all, even though such operations might be a bit slower.Update: using
php://temp
works. This solves the problem of having an interaction with the disk - PHP itself will take care of this in case a certain threshold is reached, so vfsStream doesn't have to take care of this. Additionally, this only applies to large files, but most likely not to the overwhelming majority of file sizes in unit tests.With the current patch, this example code works: