diff options
author | Pierre Joye <pajoye@php.net> | 2008-11-04 13:24:39 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2008-11-04 13:24:39 +0000 |
commit | 7102449f76cd9b3acf7455322c9a84b19a92f478 (patch) | |
tree | 35a38c72201cfcd65f095859852b6dc2fe20fed2 /ext/zip/tests/pecl12414.phpt | |
parent | 4f04fdc735a73eeb742e44a5a8aefd7cd5069aca (diff) | |
download | php-git-7102449f76cd9b3acf7455322c9a84b19a92f478.tar.gz |
- sync tests with pecl
Diffstat (limited to 'ext/zip/tests/pecl12414.phpt')
-rw-r--r-- | ext/zip/tests/pecl12414.phpt | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/zip/tests/pecl12414.phpt b/ext/zip/tests/pecl12414.phpt new file mode 100644 index 0000000000..ab11d21a63 --- /dev/null +++ b/ext/zip/tests/pecl12414.phpt @@ -0,0 +1,39 @@ +--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 |