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