1--TEST--
2Bug #42663 (gzinflate() try to allocate all memory with truncated $data)
3--EXTENSIONS--
4zlib
5--FILE--
6<?php
7// build a predictable string
8$string = '';
9for($i=0; $i<30000; ++$i) $string .= $i . ' ';
10var_dump(strlen($string));
11// deflate string
12$deflated = gzdeflate($string,9);
13var_dump(strlen($deflated));
14// truncate $deflated string
15$truncated = substr($deflated, 0, 65535);
16var_dump(strlen($truncated));
17// inflate $truncated string (check if it will not eat all memory)
18var_dump(gzinflate($truncated));
19?>
20--EXPECTF--
21int(168890)
22int(667%d)
23int(65535)
24
25Warning: gzinflate(): data error in %s on line %d
26bool(false)
27