xref: /PHP-7.1/ext/zlib/tests/005.phpt (revision 113213f0)
1--TEST--
2gzcompress()/gzuncompress() and invalid params
3--SKIPIF--
4<?php if (!extension_loaded("zlib")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gzcompress());
9var_dump(gzcompress("", 1000));
10var_dump(gzcompress("", -1));
11
12var_dump(gzcompress(""));
13var_dump(gzcompress("", 9));
14
15$string = "Answer me, it can't be so hard
16Cry to relieve what's in your heart
17Desolation, grief and agony";
18
19var_dump($data1 = gzcompress($string));
20var_dump($data2 = gzcompress($string, 9));
21
22var_dump(gzuncompress());
23var_dump(gzuncompress("", 1000));
24var_dump(gzuncompress("", -1));
25
26var_dump(gzuncompress(""));
27var_dump(gzuncompress("", 9));
28
29var_dump(gzuncompress($data1));
30var_dump(gzuncompress($data2));
31$data2{4} = 0;
32var_dump(gzuncompress($data2));
33
34echo "Done\n";
35?>
36--EXPECTF--
37Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d
38NULL
39
40Warning: gzcompress(): compression level (1000) must be within -1..9 in %s on line %d
41bool(false)
42string(%d) "%a"
43string(%d) "%a"
44string(%d) "%a"
45string(%d) "%a"
46string(%d) "%a"
47
48Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d
49NULL
50
51Warning: gzuncompress(): %s error in %s on line %d
52bool(false)
53
54Warning: gzuncompress(): length (-1) must be greater or equal zero in %s on line %d
55bool(false)
56
57Warning: gzuncompress(): %s error in %s on line %d
58bool(false)
59
60Warning: gzuncompress(): %s error in %s on line %d
61bool(false)
62string(94) "Answer me, it can't be so hard
63Cry to relieve what's in your heart
64Desolation, grief and agony"
65string(94) "Answer me, it can't be so hard
66Cry to relieve what's in your heart
67Desolation, grief and agony"
68
69Warning: gzuncompress(): %s error in %s on line %d
70bool(false)
71Done
72