1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/zlib/tests/gzopen_variation9.phpt
Gina Peter Banyard 5bd18e3fdc ext/zlib: Refactor tests (#18887)
- Use INI sections
- Use CGI sections
- Move data into a subfolder
- Remove ZPP tests
- Fix various bugs within tests
- Simplify some


Found while working on #18879
2025-06-21 18:03:50 +01:00

44 lines
904 B
PHP

--TEST--
Test gzopen() function : variation: try opening with possibly invalid modes
--EXTENSIONS--
zlib
--FILE--
<?php
echo "*** Testing gzopen() : variation ***\n";
$modes = array('r+', 'rf', 'w+' , 'e');
$file = __DIR__."/data/test.txt.gz";
foreach ($modes as $mode) {
echo "mode=$mode\n";
$h = gzopen($file, $mode);
echo "gzopen=";
var_dump($h);
if ($h !== false) {
gzclose($h);
}
echo "\n";
}
?>
--EXPECTF--
*** Testing gzopen() : variation ***
mode=r+
Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
gzopen=bool(false)
mode=rf
gzopen=resource(%d) of type (stream)
mode=w+
Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
gzopen=bool(false)
mode=e
Warning: gzopen(%s/test.txt.gz): Failed to open stream: %s in %s on line %d
gzopen=bool(false)