xref: /PHP-5.4/ext/zlib/tests/gzopen_error.phpt (revision 8f9ec423)
1--TEST--
2Test gzopen() function : error conditions
3--SKIPIF--
4<?php
5if (!extension_loaded("zlib")) {
6	print "skip - ZLIB extension not loaded";
7}
8?>
9--FILE--
10<?php
11/* Prototype  : resource gzopen(string filename, string mode [, int use_include_path])
12 * Description: Open a .gz-file and return a .gz-file pointer
13 * Source code: ext/zlib/zlib.c
14 * Alias to functions:
15 */
16
17echo "*** Testing gzopen() : error conditions ***\n";
18
19
20//Test gzopen with one more than the expected number of arguments
21echo "\n-- Testing gzopen() function with more than expected no. of arguments --\n";
22$filename = 'string_val';
23$mode = 'string_val';
24$use_include_path = 10;
25$extra_arg = 10;
26var_dump( gzopen($filename, $mode, $use_include_path, $extra_arg) );
27
28// Testing gzopen with one less than the expected number of arguments
29echo "\n-- Testing gzopen() function with less than expected no. of arguments --\n";
30$filename = 'string_val';
31var_dump( gzopen($filename) );
32
33?>
34===DONE===
35--EXPECTF--
36*** Testing gzopen() : error conditions ***
37
38-- Testing gzopen() function with more than expected no. of arguments --
39
40Warning: gzopen() expects at most 3 parameters, 4 given in %s on line %d
41NULL
42
43-- Testing gzopen() function with less than expected no. of arguments --
44
45Warning: gzopen() expects at least 2 parameters, 1 given in %s on line %d
46NULL
47===DONE===
48