1--TEST--
2Test gzopen() function : variation: try opening with possibly invalid modes
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() : variation ***\n";
18
19$modes = array('r+', 'rf', 'w+' , 'e');
20
21$file = dirname(__FILE__)."/004.txt.gz";
22
23foreach ($modes as $mode) {
24    echo "mode=$mode\n";
25    $h = gzopen($file, $mode);
26    echo "gzopen=";
27    var_dump($h);
28    if ($h !== false) {
29       gzclose($h);
30    }
31    echo "\n";
32}
33?>
34===DONE===
35--EXPECTF--
36*** Testing gzopen() : variation ***
37mode=r+
38
39Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
40gzopen=bool(false)
41
42mode=rf
43gzopen=resource(%d) of type (stream)
44
45mode=w+
46
47Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
48gzopen=bool(false)
49
50mode=e
51
52Warning: gzopen(%s/004.txt.gz): failed to open stream: %s in %s on line %d
53gzopen=bool(false)
54
55===DONE===