[php-src] PR #21497: Add ZipArchive::closeToString()
| From: | tstarling | Date: | Mon, 23 Mar 2026 05:34:00 +0000 |
| Subject: | [php-src] PR #21497: Add ZipArchive::closeToString() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35309@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21497
Author: tstarling
- Add a $flags parameter to ZipArchive::openString(), by analogy with ZipArchive::open(). This
allows the string to be opened read/write.
- Have the $data parameter to ZipArchive::openString() default to an empty string, for convenience
of callers that want to create an empty archive. This works on all versions of libzip since the
change in 1.6.0 only applied to files, it's opt-in for generic sources.
- Add ZipArchive::closeToString() which closes the archive and returns the resulting string. For
consistency with openString(), return an empty string if the archive is empty.
- Wrap strings passed to libzip with zip_source_function_create() instead of using
zip_source_buffer_create(). This allows us to make the string writable, and simplifies memory
management.