php-src/ext/phar/tests/tar/tar_001.phpt
Steph Fox 76640a615f - One last tweak (so Phar and no-phar work the same again now)
- Bunch of test fixes
- Note: I added a silencer to the unlink() call in zip/tarmaker to avoid system warnings here. If this messes up tests elsewhere we'll need to re-think.
2008-01-29 11:58:27 +00:00

30 lines
970 B
PHP

--TEST--
Phar: tar-based phar corrupted
--SKIPIF--
<?php if (!extension_loaded('phar')) die('skip'); ?>
<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
--FILE--
<?php
include dirname(__FILE__) . '/make_invalid_tar.php.inc';
$a = new corrupter(dirname(__FILE__) . '/tar_001.phar', 'none');
$a->init();
$a->addFile('tar_001.phpt', __FILE__);
$a->close();
$a = fopen('phar://' . dirname(__FILE__) . '/tar_001.phar/tar_001.phpt', 'rb');
try {
$a = new Phar(dirname(__FILE__) . '/tar_001.phar');
echo "should not execute\n";
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
?>
===DONE===
--CLEAN--
<?php
@unlink(dirname(__FILE__) . '/tar_001.phar');
?>
--EXPECTF--
Warning: fopen(phar://%star_001.phar/tar_001.phpt): failed to open stream: phar error: "%star_001.phar" is a corrupted tar file in %star_001.php on line %d
Cannot open phar file '%star_001.phar' with alias '(null)': phar error: "%star_001.phar" is a corrupted tar file
===DONE===