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 11echo "*** Testing gzopen() : variation ***\n"; 12 13$modes = array('r+', 'rf', 'w+' , 'e'); 14 15$file = __DIR__."/004.txt.gz"; 16 17foreach ($modes as $mode) { 18 echo "mode=$mode\n"; 19 $h = gzopen($file, $mode); 20 echo "gzopen="; 21 var_dump($h); 22 if ($h !== false) { 23 gzclose($h); 24 } 25 echo "\n"; 26} 27?> 28--EXPECTF-- 29*** Testing gzopen() : variation *** 30mode=r+ 31 32Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d 33gzopen=bool(false) 34 35mode=rf 36gzopen=resource(%d) of type (stream) 37 38mode=w+ 39 40Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d 41gzopen=bool(false) 42 43mode=e 44 45Warning: gzopen(%s/004.txt.gz): Failed to open stream: %s in %s on line %d 46gzopen=bool(false) 47 48