xref: /PHP-7.1/ext/zlib/tests/007.phpt (revision 7af945e2)
1--TEST--
2gzencode() and invalid params
3--SKIPIF--
4<?php if (!extension_loaded("zlib")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gzencode());
9var_dump(gzencode(1,1,1,1));
10var_dump(gzencode("", -10));
11var_dump(gzencode("", 100));
12var_dump(gzencode("", 1, 100));
13
14var_dump(gzencode("", -1, ZLIB_ENCODING_GZIP));
15var_dump(gzencode("", 9, ZLIB_ENCODING_DEFLATE));
16
17$string = "Light of my sun
18Light in this temple
19Light in my truth
20Lies in the darkness";
21
22var_dump(gzencode($string, 9, 3));
23
24var_dump(gzencode($string, -1, ZLIB_ENCODING_GZIP));
25var_dump(gzencode($string, 9, ZLIB_ENCODING_DEFLATE));
26
27echo "Done\n";
28?>
29--EXPECTF--
30Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d
31NULL
32
33Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d
34NULL
35
36Warning: gzencode(): compression level (-10) must be within -1..9 in %s on line %d
37bool(false)
38
39Warning: gzencode(): compression level (100) must be within -1..9 in %s on line %d
40bool(false)
41
42Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
43bool(false)
44string(%d) "%s"
45string(%d) "%s"
46
47Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
48bool(false)
49string(%d) "%s"
50string(%d) "%s"
51Done
52