summaryrefslogtreecommitdiff
path: root/ext/zip/php_zip.c
diff options
context:
space:
mode:
authorAnatoliy Belsky <ab@php.net>2012-06-07 21:06:31 +0200
committerAnatoliy Belsky <ab@php.net>2012-06-07 21:06:31 +0200
commit5ebdc46aa067359a34ed7e333e4640dc243ccb28 (patch)
tree72baabc09ea6c8f5f7bfab3a0297bbf950c35250 /ext/zip/php_zip.c
parent78811586901e08e284120edf43c53c78451e4f91 (diff)
parentbde0e8c2a14944016d9dbd0653b74e9e2b75c965 (diff)
downloadphp-git-5ebdc46aa067359a34ed7e333e4640dc243ccb28.tar.gz
Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3: zip windows fixes fixed bc break related to #57905 fixed a bit overlooked from the last libzip port brought the fix for #47667 back fixed zip entry freeing rechecked the merged libzip, took also the indents from the original to avoid confusion next time fixed a double freeing crash fixed header include initial libzip upgrade patch to 0.10.1 - BFN Conflicts: NEWS
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r--ext/zip/php_zip.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 55386558b6..f1d5d3ddc6 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1152,7 +1152,13 @@ static void php_zip_free_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC)
if (zr_rsrc) {
if (zr_rsrc->zf) {
- zip_fclose(zr_rsrc->zf);
+ if (zr_rsrc->zf->za) {
+ zip_fclose(zr_rsrc->zf);
+ } else {
+ if (zr_rsrc->zf->src)
+ zip_source_free(zr_rsrc->zf->src);
+ free(zr_rsrc->zf);
+ }
zr_rsrc->zf = NULL;
}
efree(zr_rsrc);
@@ -1321,9 +1327,8 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_open)
}
/* }}} */
-/* {{{ proto void zip_entry_close(resource zip_ent)
+/* {{{ proto bool zip_entry_close(resource zip_ent)
Close a zip entry */
-/* another dummy function to fit in the old api*/
static PHP_NAMED_FUNCTION(zif_zip_entry_close)
{
zval * zip_entry;
@@ -1334,8 +1339,8 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close)
}
ZEND_FETCH_RESOURCE(zr_rsrc, zip_read_rsrc *, &zip_entry, -1, le_zip_entry_name, le_zip_entry);
- /* we got a zip_entry resource, be happy */
- RETURN_TRUE;
+
+ RETURN_BOOL(SUCCESS == zend_list_delete(Z_LVAL_P(zip_entry)));
}
/* }}} */