Bug #53854 [Asn->Csd]: Missing constants for compression type.

From: Date: Thu, 23 Jul 2015 19:47:23 +0000
Subject: Bug #53854 [Asn->Csd]: Missing constants for compression type.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194656@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53854&edit=1

 ID:                 53854
 Updated by:         cmb@php.net
 Reported by:        rquadling@php.net
 Summary:            Missing constants for compression type.
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            Zip Related
 Operating System:   n/a
 PHP Version:        5.3SVN-2011-01-27 (SVN)
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1a7db40a1fba2f7d79f09b309bac6f957d70893f
Log: Fix #53854: Missing constants for compression type


Previous Comments:
------------------------------------------------------------------------
[2015-05-21 11:45:58] rquadling@php.net

I remember that the issue was building a zip file that contained the different compression methods.
As far as I was concerned, I just wanted to know the types if I read the archive.

------------------------------------------------------------------------
[2015-05-21 11:30:59] cmb@php.net

> But from what I can recall is that one can create a zip file
> using a modern ZIP tool that php_zip / libzip would not be able
> to undo.

Yes, that is definitely so. But that is not necessarily the issue
of this report, where it is about making the compression method
constants available, so they can be seen by doing a stat call. It
seems that your patch has already committed[1]. The only thing
that might be missing are some tests. I'll have a look at it.

[1] <http://lxr.php.net/xref/PHP_TRUNK/ext/zip/php_zip.c#3047>.

------------------------------------------------------------------------
[2015-05-21 10:46:39] rquadling@php.net

I'm sorry, I don't have this anymore. I can't recall what tools I used to generate
the files all the compression methods. But from what I can recall is that one can create a zip file
using a modern ZIP tool that php_zip / libzip would not be able to undo.

The table in http:///#1296487013 shows what I could create and
what was supported at the time.

------------------------------------------------------------------------
[2015-05-18 17:28:28] cmb@php.net

> I've got a zip file and .phpt test to cover the compression
> methods I have found.

If you still have them, it would be great if you can make a PR.

> Given what I've found so far, I'm guessing that php_zip only
> really supports storing and deflating/inflating.

php_zip relies on libzip, and this supports only these two
methods, see
<http://www.nih.at/libzip/zip_set_file_compression.html>.

------------------------------------------------------------------------
[2011-01-31 15:16:53] rquadling@php.net

I've built a zip file containing the following compression methods (the table below shows the
value, the constant name and ZipArchive::getStatusString()'s output when decompression is
attempted and fails) :

0  : CM_STORE          : Decompression supported.
1  : CM_SHRINK         : Compression method not supported.
6  : CM_IMPLODE        : Compression method not supported.
8  : CM_DEFLATE        : Decompression supported.
9  : CM_DEFLATE64      : Compression method not supported.
10 : CM_PKWARE_IMPLODE : Compression method not supported.
12 : CM_BZIP2          : Compression method not supported.
14 : CM_LZMA           : Compression method not supported.
97 : CM_WAVPACK        : Compression method not supported.
98 : CM_PPMD           : Compression method not supported.

I cannot find any app that will create a ZIP file using the following compression methods.

2  : CM_REDUCE_1
3  : CM_REDUCE_2
4  : CM_REDUCE_3
5  : CM_REDUCE_4
18 : CM_TERSE
19 : CM_LZ77

I have Terse (Hercules app) and LZ77 (I think this is the Microsoft Compress format), but they do
not create .ZIP files and the files magic-bytes are not zip related - so you can't just call
the file a .zip file and get away with it.

I've got nowhere with REDUCE.

I've got a zip file and .phpt test to cover the compression methods I have found.

Given what I've found so far, I'm guessing that php_zip only really supports storing and
deflating/inflating. The constants for the compression methods that I've managed to test should
be exposed.

Those that I've not should be removed be unexposed and removed from the documentation.

But I'd like to add to the docs something along the lines of "Other compression methods
may exist."

Richard.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=53854


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


Thread (17 messages)

« previous php.bugs (#194656) next »