xref: /PHP-5.3/ext/zlib/tests/006.phpt (revision af49e58f)
1--TEST--
2gzdeflate()/gzinflate() and invalid params
3--SKIPIF--
4<?php if (!extension_loaded("zlib")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gzdeflate());
9var_dump(gzdeflate("", 1000));
10var_dump(gzdeflate("", -1));
11
12var_dump(gzdeflate(""));
13var_dump(gzdeflate("", 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 = gzdeflate($string));
20var_dump($data2 = gzdeflate($string, 9));
21
22var_dump(gzinflate());
23var_dump(gzinflate(""));
24var_dump(gzinflate("asfwe", 1000));
25var_dump(gzinflate("asdf", -1));
26
27var_dump(gzinflate("asdf"));
28var_dump(gzinflate("asdf", 9));
29
30var_dump(gzinflate($data1));
31var_dump(gzinflate($data2));
32$data2{4} = 0;
33var_dump(gzinflate($data2));
34
35echo "Done\n";
36?>
37--EXPECTF--
38Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d
39NULL
40
41Warning: gzdeflate(): 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: gzinflate() expects at least 1 parameter, 0 given in %s on line %d
50NULL
51bool(false)
52
53Warning: gzinflate(): data error in %s on line %d
54bool(false)
55
56Warning: gzinflate(): length (-1) must be greater or equal zero in %s on line %d
57bool(false)
58
59Warning: gzinflate(): data error in %s on line %d
60bool(false)
61
62Warning: gzinflate(): data error in %s on line %d
63bool(false)
64string(94) "Answer me, it can't be so hard
65Cry to relieve what's in your heart
66Desolation, grief and agony"
67string(94) "Answer me, it can't be so hard
68Cry to relieve what's in your heart
69Desolation, grief and agony"
70
71Warning: gzinflate(): data error in %s on line %d
72bool(false)
73Done
74