1--TEST-- 2Test dictionary usage on zlib methods 3--EXTENSIONS-- 4zlib 5--FILE-- 6<?php 7 8$dict = range("a", "z"); 9 10$r = deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => $dict]); 11$a = deflate_add($r, "abdcde", ZLIB_FINISH); 12var_dump($a); 13 14$r = deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => implode("\0", $dict)."\0"]); 15$dictStr_a = deflate_add($r, "abdcde", ZLIB_FINISH); 16var_dump($dictStr_a === $a); 17 18$r = inflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => $dict]); 19var_dump(inflate_add($r, $a, ZLIB_FINISH)); 20 21$r = inflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => ["8"] + range("a", "z")]); 22var_dump(inflate_add($r, $a, ZLIB_FINISH)); 23 24?> 25--EXPECTF-- 26string(%d) "%s" 27bool(true) 28string(6) "abdcde" 29 30Warning: inflate_add(): Dictionary does not match expected dictionary (incorrect adler32 hash) in %s on line %d 31bool(false) 32