1--TEST-- 2Test gzopen() function : basic functionality for writing 3--SKIPIF-- 4<?php 5if (!extension_loaded("zlib")) { 6 print "skip - ZLIB extension not loaded"; 7} 8?> 9--FILE-- 10<?php 11echo "*** Testing gzopen() : basic functionality ***\n"; 12 13 14// Initialise all required variables 15$filename = "gzopen_basic2.txt.gz"; 16$modes = array('w', 'w+'); 17$data = "This was the information that was written"; 18 19foreach($modes as $mode) { 20 echo "testing mode -- $mode --\n"; 21 $h = gzopen($filename, $mode); 22 if ($h !== false) { 23 gzwrite($h, $data); 24 gzclose($h); 25 $h = gzopen($filename, 'r'); 26 gzpassthru($h); 27 gzclose($h); 28 echo "\n"; 29 unlink($filename); 30 } 31 else { 32 var_dump($h); 33 } 34} 35 36?> 37--EXPECTF-- 38*** Testing gzopen() : basic functionality *** 39testing mode -- w -- 40This was the information that was written 41testing mode -- w+ -- 42 43Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d 44bool(false) 45