diff options
author | Greg Beaver <cellog@php.net> | 2005-12-10 02:33:09 +0000 |
---|---|---|
committer | Greg Beaver <cellog@php.net> | 2005-12-10 02:33:09 +0000 |
commit | 0552791eca832047e532b0f38d8c5d358098a016 (patch) | |
tree | bd3a5d5079979295c24347969f620f5320ec0735 /ext | |
parent | fb5cff819dacadeb50f99eae96e9094d09a2dc09 (diff) | |
download | php-git-0552791eca832047e532b0f38d8c5d358098a016.tar.gz |
crc32 mismatch test
Diffstat (limited to 'ext')
-rw-r--r-- | ext/phar/tests/014.phpt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/phar/tests/014.phpt b/ext/phar/tests/014.phpt new file mode 100644 index 0000000000..a59507705c --- /dev/null +++ b/ext/phar/tests/014.phpt @@ -0,0 +1,20 @@ +--TEST-- +PHP_Archive::mapPhar filesize mismatch +--SKIPIF-- +<?php if (!extension_loaded("phar")) print "skip";?> +--FILE-- +<?php +function cleanup() { unlink(dirname(__FILE__) . '/008_phar.php'); } +register_shutdown_function('cleanup'); +$file = "<?php +PHP_Archive::mapPhar(5, 'hio', false); +__HALT_COMPILER(); ?>"; +// wrong crc32 +$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9); +$file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('b'), 1) . 'a'; +file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); +include dirname(__FILE__) . '/008_phar.php'; +echo file_get_contents('phar://hio/a'); +?> +--EXPECTF-- +Fatal error: file_get_contents(): phar error: internal corruption of phar "%s" (crc32 mismatch on file "a") in %s on line 12
\ No newline at end of file |