Bug #70311 [Fbk->Opn]: ZipArchive not generating output

From: Date: Fri, 21 Aug 2015 15:12:58 +0000
Subject: Bug #70311 [Fbk->Opn]: ZipArchive not generating output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195405@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70311&edit=1

 ID:                 70311
 Updated by:         cmb@php.net
 Reported by:        bergmann at berlitec dot de
 Summary:            ZipArchive not generating output
-Status:             Feedback
+Status:             Open
 Type:               Bug
 Package:            Zip Related
 Operating System:   Mac OS X 10.10.4
 PHP Version:        5.6.12
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

That had to be expected, because the internal zip_t has already
been closed. Sorry for the noise.

I found that PHP 5.6.12 with libzip 0.11.2 on Linux and Windows
silently fails (the supplied test script reports bool(true) twice)
to create archives, if there are insufficient permissions or the
folder to write to doesn't even exist. That doesn't appear to be
the problem in your case, but anyway there has to be some
indication of the failure.

For debugging purposes consider to modify the relevant code[1]:

    if (zip_close(intern)) {
printf("%s\n", zip_strerror(intern));
        zip_discard(intern);
    }

[1] <https://github.com/php/php-src/blob/php-5.6.12/ext/zip/php_zip.c#L1628-L1630>


Previous Comments:
------------------------------------------------------------------------
[2015-08-21 13:18:43] bergmann at berlitec dot de

@cmb:

Warning: ZipArchive::getStatusString(): Invalid or uninitialized Zip object in ...

------------------------------------------------------------------------
[2015-08-21 13:14:39] cmb@php.net

AIUI, ZipArchive::close() returns TRUE even if the operation
may have failed[1]. What is the result of calling

  var_dump( $a->getStatusString () );
  
at the end of the script?

[1] <https://github.com/php/php-src/blob/php-5.6.12/ext/zip/php_zip.c#L1628-L1637>

------------------------------------------------------------------------
[2015-08-20 11:56:44] bergmann at berlitec dot de

Description:
------------
ZipArchive doesn't produce the desired results on my system. I can see a temporary zipfile
created but it disappears as soon as my script exits without producing the final zip.

phpinfo()
PHP Version 5.6.12
Zip 	enabled
Extension Version 	$Id: f9f12af1274212b9f22867472e4aa57eab4bb4cf $
Zip version 	1.12.5
Libzip version 	0.11.2 

I was originally executing a phing ZipTask but I made a quick test that revealed ZipArchive itself
is bugged for me. Apache mod and cli both are affected.

I tested the behaviour with another 5.4.x installation on my system that ran just fine.

Test script:
---------------
<?php
        
$a = new ZipArchive;
var_dump( $a->open(__DIR__ . '/test.zip', ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)
);
$a->addFromString('test.txt', 'test');
var_dump( $a->close() );

Expected result:
----------------
boolean(true)
boolean(true)

test.zip created with a single file test.txt

Actual result:
--------------
boolean(true)
boolean(true)

no zip generated, temporary zip pops up and disappears, no zip in target directory or above, no zip
in the trash


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70311&edit=1


Thread (11 messages)

« previous php.bugs (#195405) next »