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