Annotation of embedaddon/php/ext/zip/tests/bug53579.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #53579 (stream_get_contents() segfaults on ziparchive streams)
! 3: --SKIPIF--
! 4: <?php
! 5: /* $Id: oo_stream.phpt 260091 2008-05-21 09:27:41Z pajoye $ */
! 6: if(!extension_loaded('zip')) die('skip');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: $dirname = dirname(__FILE__) . '/';
! 11: $file = $dirname . 'test_with_comment.zip';
! 12: include $dirname . 'utils.inc';
! 13: $zip = new ZipArchive;
! 14: if (!$zip->open($file)) {
! 15: exit('failed');
! 16: }
! 17: $fp = $zip->getStream('foo');
! 18:
! 19: var_dump($fp);
! 20: if(!$fp) exit("\n");
! 21: $contents = stream_get_contents($fp);
! 22:
! 23: fclose($fp);
! 24: $zip->close();
! 25: var_dump($contents);
! 26:
! 27:
! 28: $fp = fopen('zip://' . dirname(__FILE__) . '/test_with_comment.zip#foo', 'rb');
! 29: if (!$fp) {
! 30: exit("cannot open\n");
! 31: }
! 32: $contents = stream_get_contents($fp);
! 33: var_dump($contents);
! 34: fclose($fp);
! 35:
! 36: ?>
! 37: --EXPECTF--
! 38: resource(%d) of type (stream)
! 39: string(5) "foo
! 40:
! 41: "
! 42: string(5) "foo
! 43:
! 44: "
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>