xref: /PHP-8.0/ext/zip/tests/bug49072.phpt (revision f8d79582)
1--TEST--
2Bug #49072 (feof never returns true for damaged file in zip)
3--SKIPIF--
4<?php
5if(!extension_loaded('zip')) die('skip');
6?>
7--FILE--
8<?php
9$f = __DIR__  . '/bug49072.zip';
10$o = new ZipArchive();
11if (! $o->open($f, ZipArchive::CHECKCONS)) {
12    exit ('error can\'t open');
13}
14$r = $o->getStream('file1'); // this file has a wrong crc
15if (!$r)die('failed to open a stream for file1');
16$s = '';
17while (! feof($r)) {
18    $s .= fread($r,1024);
19}
20?>
21--EXPECTF--
22Warning: fread(): Zip stream error: CRC error in %s on line %d
23