xref: /PHP-8.0/ext/zlib/tests/bug_52944.phpt (revision 3d1b730c)
1--TEST--
2Bug #52944 (segfault with zlib filter and corrupted data)
3--SKIPIF--
4<?php if (!extension_loaded("zlib")) print "skip"; ?>
5--INI--
6allow_url_fopen=1
7--FILE--
8<?php
9/* NOTE this test can fail on asm builds of zlib 1.2.5 or
10   1.2.7 on at least Windows and Darwin. Using unoptimized
11   zlib build fixes the issue. */
12
13require __DIR__ . "/bug_52944_corrupted_data.inc";
14
15$fp = fopen('data://text/plain;base64,' . $data, 'r');
16stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
17var_dump(fread($fp,1));
18var_dump(fread($fp,1));
19fclose($fp);
20echo "Done.\n";
21?>
22--EXPECTF--
23Notice: fread(): zlib: data error in %s on line %d
24bool(false)
25string(0) ""
26Done.
27