Bug #73944 [Opn]: dictionary option of intflate_init() does not work
| From: | cmb@php.net | Date: | Mon, 16 Jan 2017 11:39:33 +0000 |
| Subject: | Bug #73944 [Opn]: dictionary option of intflate_init() does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206666@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73944&edit=1
ID: 73944
Updated by: cmb@php.net
Reported by: someone dot wanted dot to dot be dot unknown at
gmail dot com
Summary: dictionary option of intflate_init() does not work
Status: Open
Type: Bug
Package: Zlib related
Operating System: Windows 10 x64
PHP Version: 7.1.0
-Assigned To:
+Assigned To: bwoebi
Block user comment: N
Private report: N
New Comment:
Bob, as you've added the dictionary option[1], could you please
have a look at this.
[1] <http://git.php.net/?p=php-src.git;a=commit;h=dd17e18f>
Previous Comments:
------------------------------------------------------------------------
[2017-01-16 10:11:00] someone dot wanted dot to dot be dot unknown at gmail dot com
change title
------------------------------------------------------------------------
[2017-01-16 10:05:32] someone dot wanted dot to dot be dot unknown at gmail dot com
Description:
------------
I'm writing an unpacker of MSZIP blocks that use deflate compression.
I faced a problem and created a question on stackoverflow
(http://stackoverflow.com/questions/41653663/is-there-something-special-in-windows-mszip-format-or-cfdata-in-cab-files),
where maintainer of zlib library adviced to use
dictionary option to pass raw
uncompressed data of previous block to decompress next block of data. But Mark Adler says that this
option don't work in current php realisation.
> Looks like a bug. I can't get the dictionary option to work at all, even with strings that
> don't have nulls.
Test script:
---------------
$in = inflate_init(ZLIB_ENCODING_RAW);
$a = inflate_add($in, file_get_contents('https://github.com/wapmorgan/CabArchive/releases/download/0.0.1-dev/1block'));
echo '1 block: '.strlen($a).PHP_EOL;
$in = inflate_init(ZLIB_ENCODING_RAW, array('dictionary' =>
str_replace("\00", null, $a)."\00"));
$b = inflate_add($in, file_get_contents('https://github.com/wapmorgan/CabArchive/releases/download/0.0.1-dev/2block'));
echo '2 block: '.($b === false ? 'failed' : strlen($b)).PHP_EOL;
Expected result:
----------------
1 block: 32768
2 block: 32768
Actual result:
--------------
1 block: 32768
2 block: failed
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73944&edit=1