Commit:    a37e84e549669dbcca0b94a69a5409591eb0c6bb
Author:    Anatoliy Belsky <a...@php.net>         Tue, 5 Jun 2012 22:49:31 +0200
Parents:   f4a44f18b8fe5d23a11d12b048d4effce283379f
Branches:  PHP-5.3 PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=a37e84e549669dbcca0b94a69a5409591eb0c6bb

Log:
fixed zip entry freeing

Changed paths:
  M  ext/zip/php_zip.c


Diff:
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 0123315..f3d37c8 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1148,7 +1148,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)));
 }
 /* }}} */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to