Add ZipArchive::closeString()#21497
Conversation
6ad9c14 to
f8b8959
Compare
|
Imo, either |
2c11df3 to
a266aa3
Compare
|
@ndossche It would be good to have your review on this. @remicollet I considered making an @alecpl I think |
|
@tstarling I'm sorry but I'm taking a step back from PHP, so someone else will need to review this. |
09a25f1 to
283c75c
Compare
@alecpl I renamed it from |
283c75c to
5eae17f
Compare
| ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_ZipArchive_openString, 0, 1, MAY_BE_BOOL|MAY_BE_LONG) | ||
| ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) | ||
| ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_ZipArchive_openString, 0, 0, MAY_BE_BOOL|MAY_BE_LONG) | ||
| ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, data, IS_STRING, 0, "\'\'") |
There was a problem hiding this comment.
hmm, @kocsismate does this need to be escaped in the arginfo? Not an actual suggestion to change in this patch, but just to document my thinking, why couldn't this be
| ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, data, IS_STRING, 0, "\'\'") | |
| ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, data, IS_STRING, 0, "''") |
? (Just using this as an example since I'm not sure I've seen it before - since this is automatically generated please don't actually apply this suggestion @tstarling)
5eae17f to
de15d91
Compare
DanielEScherzer
left a comment
There was a problem hiding this comment.
generally looks good, I'll take another look after #21659 merges so it is easier to see what is changing in this patch
de15d91 to
248c02c
Compare
DanielEScherzer
left a comment
There was a problem hiding this comment.
thanks for splitting out #21659, makes this so much easier to review
a few suggestions, code mostly looks good
| zend_string_release(obj->out_str); | ||
| } | ||
| obj->out_str = NULL; | ||
| } |
There was a problem hiding this comment.
if obj->out_str is not set, we should ensure that callers do not try to use the out_str, suggest adding
| } | |
| } else { | |
| ZEND_ASSERT(!out_str); | |
| } |
There was a problem hiding this comment.
I had to revert this, since the assertion fails when closeString() is called but something goes wrong with saving the archive. The caller is already guarding for that, and false is returned to userspace. There was already a test, which failed due to the assertion.
9b8c4fd to
59e42cd
Compare
- 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::closeString() which closes the archive and returns the resulting string. For consistency with openString(), return an empty string if the archive is empty.
59e42cd to
26e6159
Compare
Uh oh!
There was an error while loading. Please reload this page.