File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / zip / tests / pecl12414.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, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_17p0, v5_3_10, HEAD
php

--TEST--
Bug #12414 ( extracting files from damaged archives)
--SKIPIF--
<?php
/*$ */
if(!extension_loaded('zip')) die('skip');
 ?>
--FILE--
<?php
$filename = 'MYLOGOV2.GFX';
$zipname = dirname(__FILE__) . "/pecl12414.zip";
$za = new ZipArchive();
$res =$za->open($zipname);
if ($res === TRUE) {
	$finfo=$za->statName($filename);
	$file_size=$finfo['size'];

	if($file_size>0) {
		$contents=$za->getFromName($filename);

		echo "ZIP contents size: " . strlen($contents) . "\n";
		if(strlen($contents)!=$file_size) {
			echo "zip_readfile recorded data does not match unpacked size: " . $zipname . " : " . $filename;
		}
	} else {
		$contents=false;
		echo "zip_readfile could not open stream from zero length file " . $zipname . " : " .$filename;
	}

	$za->close();
} else {
	echo "zip_readfile could not read from " . $zipname . " : " . $filename;
}

?>
--DONE--
--EXPECTF--
ZIP contents size: %d
zip_readfile recorded data does not match unpacked size: %specl12414.zip : MYLOGOV2.GFX

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