xref: /PHP-5.4/ext/zlib/tests/006.phpt (revision 11d24c15)
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
51
52Warning: gzinflate(): data error in %s on line %d
53bool(false)
54
55Warning: gzinflate(): data error in %s on line %d
56bool(false)
57
58Warning: gzinflate(): length (-1) must be greater or equal zero in %s on line %d
59bool(false)
60
61Warning: gzinflate(): data error in %s on line %d
62bool(false)
63
64Warning: gzinflate(): data error in %s on line %d
65bool(false)
66string(94) "Answer me, it can't be so hard
67Cry to relieve what's in your heart
68Desolation, grief and agony"
69string(94) "Answer me, it can't be so hard
70Cry to relieve what's in your heart
71Desolation, grief and agony"
72
73Warning: gzinflate(): data error in %s on line %d
74bool(false)
75Done
76