Annotation of embedaddon/php/ext/phar/tests/tar/tar_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar: tar-based phar corrupted
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded('phar')) die('skip'); ?>
! 5: <?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
! 6: --FILE--
! 7: <?php
! 8: include dirname(__FILE__) . '/files/make_invalid_tar.php.inc';
! 9:
! 10: $tar = new corrupter(dirname(__FILE__) . '/tar_001.phar.tar', 'none');
! 11: $tar->init();
! 12: $tar->addFile('tar_001.phpt', __FILE__);
! 13: $tar->close();
! 14:
! 15: $tar = fopen('phar://' . dirname(__FILE__) . '/tar_001.phar.tar/tar_001.phpt', 'rb');
! 16: try {
! 17: $phar = new Phar(dirname(__FILE__) . '/tar_001.phar.tar');
! 18: echo "should not execute\n";
! 19: } catch (Exception $e) {
! 20: echo $e->getMessage() . "\n";
! 21: }
! 22: ?>
! 23: ===DONE===
! 24: --CLEAN--
! 25: <?php
! 26: @unlink(dirname(__FILE__) . '/tar_001.phar.tar');
! 27: ?>
! 28: --EXPECTF--
! 29: Warning: fopen(phar://%star_001.phar.tar/tar_001.phpt): failed to open stream: phar error: "%star_001.phar.tar" is a corrupted tar file (truncated) in %star_001.php on line 9
! 30: phar error: "%star_001.phar.tar" is a corrupted tar file (truncated)
! 31: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>