stream_meta_data.phpt 1.1 KB

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