xref: /php-src/ext/zip/tests/pecl12414.phpt (revision 74859783)
1--TEST--
2Bug #12414 ( extracting files from damaged archives)
3--EXTENSIONS--
4zip
5--SKIPIF--
6<?php
7/*$ */
8?>
9--FILE--
10<?php
11$filename = 'MYLOGOV2.GFX';
12$zipname = __DIR__ . "/pecl12414.zip";
13$za = new ZipArchive();
14$res =$za->open($zipname);
15if ($res === TRUE) {
16    $finfo=$za->statName($filename);
17    $file_size=$finfo['size'];
18
19    if($file_size>0) {
20        $contents=$za->getFromName($filename);
21
22        echo "ZIP contents size: " . strlen($contents) . "\n";
23        if(strlen($contents)!=$file_size) {
24            echo "zip_readfile recorded data does not match unpacked size: " . $zipname . " : " . $filename;
25        }
26    } else {
27        $contents=false;
28        echo "zip_readfile could not open stream from zero length file " . $zipname . " : " .$filename;
29    }
30
31    $za->close();
32} else {
33    echo "zip_readfile could not read from " . $zipname . " : " . $filename;
34}
35
36?>
37--EXPECTF--
38zip_readfile could not read from %specl12414.zip : MYLOGOV2.GFX
39