1--TEST-- 2stream_get_meta_data() on zip stream 3--SKIPIF-- 4<?php 5/* $Id: oo_stream.phpt 260091 2008-05-21 09:27:41Z pajoye $ */ 6if(!extension_loaded('zip')) die('skip'); 7?> 8--FILE-- 9<?php 10$dirname = dirname(__FILE__) . '/'; 11$file = $dirname . 'test_with_comment.zip'; 12include $dirname . 'utils.inc'; 13$zip = new ZipArchive; 14if (!$zip->open($file)) { 15 exit('failed'); 16} 17$fp = $zip->getStream('foo'); 18 19if(!$fp) exit("\n"); 20 21var_dump(stream_get_meta_data($fp)); 22 23fclose($fp); 24$zip->close(); 25 26 27$fp = fopen('zip://' . dirname(__FILE__) . '/test_with_comment.zip#foo', 'rb'); 28if (!$fp) { 29 exit("cannot open\n"); 30} 31 32var_dump(stream_get_meta_data($fp)); 33fclose($fp); 34 35?> 36--EXPECTF-- 37array(8) { 38 ["stream_type"]=> 39 string(3) "zip" 40 ["mode"]=> 41 string(2) "rb" 42 ["unread_bytes"]=> 43 int(0) 44 ["seekable"]=> 45 bool(false) 46 ["uri"]=> 47 string(3) "foo" 48 ["timed_out"]=> 49 bool(false) 50 ["blocked"]=> 51 bool(true) 52 ["eof"]=> 53 bool(false) 54} 55array(9) { 56 ["wrapper_type"]=> 57 string(11) "zip wrapper" 58 ["stream_type"]=> 59 string(3) "zip" 60 ["mode"]=> 61 string(2) "rb" 62 ["unread_bytes"]=> 63 int(0) 64 ["seekable"]=> 65 bool(false) 66 ["uri"]=> 67 string(%d) "zip://%stest_with_comment.zip#foo" 68 ["timed_out"]=> 69 bool(false) 70 ["blocked"]=> 71 bool(true) 72 ["eof"]=> 73 bool(false) 74} 75