summaryrefslogtreecommitdiff
path: root/ext/zlib/tests/dictionary_usage.phpt
blob: 8ffa9e8bcd9b496d12c1037b290c4a5ffb242ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--TEST--
Test dictionary usage on zlib methods
--FILE--
<?php

$dict = range("a", "z");

$r = deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => $dict]);
$a = deflate_add($r, "abdcde", ZLIB_FINISH);
var_dump($a);

$r = inflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => $dict]);
var_dump(inflate_add($r, $a, ZLIB_FINISH));


$r = inflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => ["8"] + range("a", "z")]);
var_dump(inflate_add($r, $a, ZLIB_FINISH));

?>
--EXPECTF--
string(%d) "%s"
string(6) "abdcde"

Warning: inflate_add(): dictionary does not match expected dictionary (incorrect adler32 hash) in %s on line %d
bool(false)