Bug #73944 [NEW]: dictionary option does not work
| From: | someone dot wanted dot to dot be dot unknown at gmail dot com | Date: | Mon, 16 Jan 2017 10:05:41 +0000 |
| Subject: | Bug #73944 [NEW]: dictionary option does not work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-206659@lists.php.net to get a copy of this message | ||
From: someone dot wanted dot to dot be dot unknown at gmail dot com
Operating system: Windows 10 x64
PHP version: 7.1.0
Package: Zlib related
Bug Type: Bug
Bug description:dictionary option does not work
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 bug report at https://bugs.php.net/bug.php?id=73944&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73944&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73944&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73944&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73944&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73944&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73944&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73944&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73944&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73944&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73944&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73944&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73944&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73944&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73944&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73944&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73944&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73944&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73944&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73944&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73944&r=mysqlcfg