php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57197 Create an archive always fails
Submitted: 2006-08-26 02:19 UTC Modified: 2006-08-26 11:47 UTC
From: Fedora at FamilleCollet dot com Assigned: pajoye (profile)
Status: Closed Package: zip (PECL)
PHP Version: 5.1.4 OS: Fedora Core 5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Fedora at FamilleCollet dot com
New email:
PHP Version: OS:

 

 [2006-08-26 02:19 UTC] Fedora at FamilleCollet dot com
Description:
------------
With new zip-1.7.1 (with php-5.1.5), opening an archive with ZIPARCHIVE::CREATE flag doesn't work.

Probably because open mode passed to zip_open always = 0.



Reproduce code:
---------------
Example "create.php" from the source package.

Expected result:
----------------
$ cd /tmp
$ php ....php-pecl-zip-1.7.0/examples/create.php
file <./test112.zip> OK
numfiles: 3
status:0


Actual result:
--------------
$ php ....php-pecl-zip-1.7.1/examples/create.php
cannot open <./test112.zip>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-26 06:44 UTC] pierre dot php at gmail dot com
I cannot reproduce here.

"Probably because open mode passed to zip_open always = 0."

That's a wrong statement.

are you sure you have the write permission in /tmp/?
 [2006-08-26 07:10 UTC] Fedora at FamilleCollet dot com
Yes, i have write permission in /tmp.

And the same script (the example for zip-*.tgz) works with version 1.7.0 in the same conditions.

When I say "Probably because open mode passed to zip_open always = 0."

It's because in version 1.7.0 we have (php_zip.c) the mode from the function args :

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename, &filename_len, &mode) == FAILURE) {
                return;
        }
rsrc_int->za = zip_open(filename, mode, &err);

And in version 1.7.1, we only have:

rsrc_int->za = zip_open(filename, 0, &err);

Cordialy
 [2006-08-26 08:10 UTC] pierre dot php at gmail dot com
"rsrc_int->za = zip_open(filename, 0, &err);"

It is the zip_open function, which is read only. I nuked the unused mode variable. the open() method is defined by ZIPARCHIVE_METHOD(open).

I think I found the problem, 1.7.1 fixed a problem in threaded environment and... break it in non threaded environment.

Can you try using pecl cvs (HEAD)? I just commited a one line fix.
 [2006-08-26 11:32 UTC] Fedora at FamilleCollet dot com
Build with php_zip.c version 1.73 from CVS.
All seems OK.
examples/create.php (and my other scripts) works now.

Thanks.

php-pecl-zip will be (very) soon in Fedora Extras.
 [2006-08-26 11:47 UTC] pierre dot php at gmail dot com
"Build with php_zip.c version 1.73 from CVS.
All seems OK. examples/create.php (and my other scripts) works now."

Nice, thanks for the head up and the tests :)

"php-pecl-zip will be (very) soon in Fedora Extras."

Good to hear :)

Please note that 5.2.0 will have it bundeld and will match the upcoming zip-2.0.0-stable. I will release it in the next few days, the relative paths in TS mode was the last known bug.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Nov 17 18:01:33 2019 UTC