1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 01:18:19 +02:00
Files
archived-php-src/ext/zlib/tests/inflate_add_error.phpt
T
George Peter Banyard 928afd8fb7 Convert some warnings to Error in zlib extension
Closes GH-4985
2020-01-09 00:56:58 +01:00

31 lines
747 B
PHP

--TEST--
Test incremental inflate_add() error functionality
--SKIPIF--
<?php
if (!extension_loaded("zlib")) {
print "skip - ZLIB extension not loaded";
}
?>
--FILE--
<?php
$badResource = fopen("php://memory", "r+");
try {
var_dump(inflate_add($badResource, "test"));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
$resource = inflate_init(ZLIB_ENCODING_DEFLATE);
$badFlushType = 6789;
try {
var_dump(inflate_add($resource, "test", $badFlushType));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
inflate_add(): supplied resource is not a valid zlib inflate resource
Flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH