File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / zip / tests / bug49072.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:05 2012 UTC (12 years, 10 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #49072 (feof never returns true for damaged file in zip)
--SKIPIF--
<?php
/* $Id: bug49072.phpt,v 1.1.1.1 2012/02/21 23:48:05 misho Exp $ */
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
<?php
$f = dirname(__FILE__)  . '/bug49072.zip';
$o = new ZipArchive();
if (! $o->open($f, ZipArchive::CHECKCONS)) {
	exit ('error can\'t open');
}
$r = $o->getStream('file1'); // this file has a wrong crc
if (!$r)die('failed to open a stream for file1');
$s = '';
while (! feof($r)) {
	$s .= fread($r,1024);
}
?>
--EXPECTF--

Warning: fread(): Zip stream error: CRC error in %s on line %d

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>