1--TEST-- 2getStream 3--SKIPIF-- 4<?php 5if(!extension_loaded('zip')) die('skip'); 6?> 7--FILE-- 8<?php 9$dirname = dirname(__FILE__) . '/'; 10$file = $dirname . 'test_with_comment.zip'; 11include $dirname . 'utils.inc'; 12$zip = new ZipArchive; 13if (!$zip->open($file)) { 14 exit('failed'); 15} 16$fp = $zip->getStream('foo'); 17 18var_dump($fp); 19if(!$fp) exit("\n"); 20$contents = ''; 21while (!feof($fp)) { 22 $contents .= fread($fp, 255); 23} 24 25fclose($fp); 26$zip->close(); 27var_dump($contents); 28 29 30$fp = fopen('zip://' . dirname(__FILE__) . '/test_with_comment.zip#foo', 'rb'); 31if (!$fp) { 32 exit("cannot open\n"); 33} 34$contents = ''; 35while (!feof($fp)) { 36 $contents .= fread($fp, 2); 37} 38var_dump($contents); 39fclose($fp); 40 41?> 42--EXPECTF-- 43resource(%d) of type (stream) 44string(5) "foo 45 46" 47string(5) "foo 48 49" 50