xref: /PHP-5.4/ext/zlib/tests/005.phpt (revision af49e58f)
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--
37
38Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d
39NULL
40
41Warning: gzcompress(): compression level (1000) must be within -1..9 in %s on line %d
42bool(false)
43string(%d) "%a"
44string(%d) "%a"
45string(%d) "%a"
46string(%d) "%a"
47string(%d) "%a"
48
49Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d
50NULL
51
52Warning: gzuncompress(): %s error in %s on line %d
53bool(false)
54
55Warning: gzuncompress(): length (-1) must be greater or equal zero in %s on line %d
56bool(false)
57
58Warning: gzuncompress(): %s error in %s on line %d
59bool(false)
60
61Warning: gzuncompress(): %s error in %s on line %d
62bool(false)
63string(94) "Answer me, it can't be so hard
64Cry to relieve what's in your heart
65Desolation, grief and agony"
66string(94) "Answer me, it can't be so hard
67Cry to relieve what's in your heart
68Desolation, grief and agony"
69
70Warning: gzuncompress(): %s error in %s on line %d
71bool(false)
72Done
73