diff options
author | Greg Beaver <cellog@php.net> | 2008-01-05 23:02:23 +0000 |
---|---|---|
committer | Greg Beaver <cellog@php.net> | 2008-01-05 23:02:23 +0000 |
commit | 632a633154f4c86ce6e4c08a2b76e8dc858e83f1 (patch) | |
tree | e2023d553a68062f4489688d75fd0ebb916af689 /ext/phar/tests/tar | |
parent | bd0d9e8de3b308d507b697475d4488dd0a4cfc98 (diff) | |
download | php-git-632a633154f4c86ce6e4c08a2b76e8dc858e83f1.tar.gz |
fix segfault, add separate tar test for readonly=0 on corrupted tar
Diffstat (limited to 'ext/phar/tests/tar')
-rw-r--r-- | ext/phar/tests/tar/tar_001.phpt | 11 | ||||
-rw-r--r-- | ext/phar/tests/tar/tar_002.phpt | 32 |
2 files changed, 36 insertions, 7 deletions
diff --git a/ext/phar/tests/tar/tar_001.phpt b/ext/phar/tests/tar/tar_001.phpt index 4e888c0d02..af15609119 100644 --- a/ext/phar/tests/tar/tar_001.phpt +++ b/ext/phar/tests/tar/tar_001.phpt @@ -3,9 +3,6 @@ Phar: tar-based phar corrupted --SKIPIF-- <?php if (!extension_loaded('phar')) die('skip'); ?> <?php if (!extension_loaded("spl")) die("skip SPL not available"); ?> ---INI-- -phar.readonly=0 -phar.require_hash=0 --FILE-- <?php include dirname(__FILE__) . '/make_invalid_tar.php.inc'; @@ -14,9 +11,9 @@ $a->init(); $a->addFile('tar_001.phpt', __FILE__); $a->close(); -$a = fopen('phar://tar_001.phar/tar_001.phpt', 'rb'); +$a = fopen('phar://' . dirname(__FILE__) . '/tar_001.phar/tar_001.phpt', 'rb'); try { -$a = new Phar('tar_001.phar'); +$a = new Phar(dirname(__FILE__) . '/tar_001.phar'); echo "should not execute\n"; } catch (Exception $e) { echo $e->getMessage() . "\n"; @@ -28,6 +25,6 @@ echo $e->getMessage() . "\n"; @unlink(dirname(__FILE__) . '/tar_001.phar'); ?> --EXPECTF-- -Warning: fopen(phar://tar_001.phar/tar_001.phpt): failed to open stream: phar error: "tar_001.phar" is a corrupted tar file in %s/tar_001.php on line %d -Cannot open phar file 'tar_001.phar' with alias '(null)': phar error: "tar_001.phar" is a corrupted tar file +Warning: fopen(phar://%s/tar_001.phar/tar_001.phpt): failed to open stream: phar error: "%s/tar_001.phar" is a corrupted tar file in %s/tar_001.php on line %d +Cannot open phar file '%s/tar_001.phar' with alias '(null)': phar error: "%s/tar_001.phar" is a corrupted tar file ===DONE===
\ No newline at end of file diff --git a/ext/phar/tests/tar/tar_002.phpt b/ext/phar/tests/tar/tar_002.phpt new file mode 100644 index 0000000000..f815dbfe30 --- /dev/null +++ b/ext/phar/tests/tar/tar_002.phpt @@ -0,0 +1,32 @@ +--TEST-- +Phar: tar-based phar corrupted 2 +--SKIPIF-- +<?php if (!extension_loaded('phar')) die('skip'); ?> +<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?> +--INI-- +phar.readonly=0 +--FILE-- +<?php +include dirname(__FILE__) . '/make_invalid_tar.php.inc'; +$a = new corrupter(dirname(__FILE__) . '/tar_002.phar', 'none'); +$a->init(); +$a->addFile('tar_002.phpt', __FILE__); +$a->close(); + +$a = fopen('phar://' . dirname(__FILE__) . '/tar_002.phar/tar_002.phpt', 'rb'); +try { +$a = new Phar(dirname(__FILE__) . '/tar_002.phar'); +echo "should not execute\n"; +} catch (Exception $e) { +echo $e->getMessage() . "\n"; +} +?> +===DONE=== +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . '/tar_002.phar'); +?> +--EXPECTF-- +Warning: fopen(phar://%s/tar_002.phar/tar_002.phpt): failed to open stream: phar error: "%s/tar_002.phar" is a corrupted tar file in %s/tar_002.php on line %d +Cannot open phar file '%s/tar_002.phar' with alias '(null)': phar error: "%s/tar_002.phar" is a corrupted tar file +===DONE===
\ No newline at end of file |