bug53579.phpt 703 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Bug #53579 (stream_get_contents() segfaults on ziparchive streams)
  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. var_dump($fp);
  16. if(!$fp) exit("\n");
  17. $contents = stream_get_contents($fp);
  18. fclose($fp);
  19. $zip->close();
  20. var_dump($contents);
  21. $fp = fopen('zip://' . __DIR__ . '/test_with_comment.zip#foo', 'rb');
  22. if (!$fp) {
  23. exit("cannot open\n");
  24. }
  25. $contents = stream_get_contents($fp);
  26. var_dump($contents);
  27. fclose($fp);
  28. ?>
  29. --EXPECTF--
  30. resource(%d) of type (stream)
  31. string(5) "foo
  32. "
  33. string(5) "foo
  34. "