-
Notifications
You must be signed in to change notification settings - Fork 19
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
Teaching zipstreamer new tricks: addFileFromString & addFileOpen/Write/Close #36
Open
rivimey
wants to merge
25
commits into
McNetic:master
Choose a base branch
from
rivimey:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…older, move phpunit.xml and update composer)
…l (it is not a bitmask)
…and add the remaining bits. -- no functionality added though!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We needed a PHP Zip archive creator that would stream all the way - so no temporary files at any point. I have based some code on your work that adds two facilities we needed: adding a file from immediate data (i.e. a php string) and adding a file a chunk at a time. The use-case is for the Excel-writer library Spout, which I am also modifying to use ZipStreamer rather than ZipArchive.
I have included some additional tests, and modified the manual.md to describe the new api functions.
The new test does fail, but I think the problem is the test itself: the file size in the directory is expected to be 0 and (in this case) is 808. I believe this is because for the addFileFromString the code has all the data to hand and so sets the length in the file header, rather than appending a file extension record. I am, however, not sure on this point, nor how to modify the test such that it works properly :( so I would appreciate your input if you are able.
ZipStreamer\TestZipStreamer::testZipfileStreamed with data set #1 (array(true, 0, 1), array(ZipStreamer\File Object (...)), 'one empty dir (options = arra...RMAL))')
Z64EIF size
Failed asserting that two objects are equal.
--- Expected
+++ Actual
@@ @@
ZipStreamer\Count64_64 Object (
'limit32Bit' => false
)
.../PHPZipStreamer/test/ZipComponents.php:83
.../PHPZipStreamer/test/ZipStreamerTest.php:218
.../PHPZipStreamer/test/ZipStreamerTest.php:443
I have included the .idea directory from phpstorm - just as a helpful thing, and I'll remove it from the pull if you wish.
One thing I would like to do would be make it psr-4 compliant, but I think this would be quite a big change in the files so I've not done anything!