php-8.0.30-src/ext/zlib/tests/bug_52944.phpt

27 lines
669 B
PHP

--TEST--
Bug #52944 (segfault with zlib filter and corrupted data)
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--INI--
allow_url_fopen=1
--FILE--
<?php
/* NOTE this test can fail on asm builds of zlib 1.2.5 or
1.2.7 on at least Windows and Darwin. Using unoptimized
zlib build fixes the issue. */
require __DIR__ . "/bug_52944_corrupted_data.inc";
$fp = fopen('data://text/plain;base64,' . $data, 'r');
stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
var_dump(fread($fp,1));
var_dump(fread($fp,1));
fclose($fp);
echo "Done.\n";
?>
--EXPECTF--
Notice: fread(): zlib: data error in %s on line %d
bool(false)
string(0) ""
Done.