Annotation of embedaddon/php/ext/zip/tests/pecl12414.phpt, revision 1.1

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

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