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/gzclose_basic.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

40 lines
736 B
PHP

--TEST--
Test function gzclose() by calling it with its expected arguments
--EXTENSIONS--
zlib
--FILE--
<?php
// note that gzclose is an alias to fclose. parameter checking tests will be
// the same as fclose
$f = __DIR__."/data/test.txt.gz";
$h = gzopen($f, 'r');
gzread($h, 20);
var_dump(gzclose($h));
//should fail.
try {
gzread($h, 20);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
$h = gzopen($f, 'r');
gzread($h, 20);
var_dump(fclose($h));
//should fail.
try {
gzread($h, 20);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
bool(true)
gzread(): Argument #1 ($stream) must be an open stream resource
bool(true)
gzread(): Argument #1 ($stream) must be an open stream resource