From: Marcus Boerger Date: Wed, 4 Jan 2006 16:43:42 +0000 (+0000) Subject: - Update tests X-Git-Tag: RELEASE_1_0_4~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f27248fbf03925f6aee27ff9ff901310bf2df05;p=php - Update tests --- diff --git a/ext/phar/tests/008.phpt b/ext/phar/tests/008.phpt index 254e7e8e00..125d1a9a31 100644 --- a/ext/phar/tests/008.phpt +++ b/ext/phar/tests/008.phpt @@ -4,14 +4,14 @@ Phar::mapPhar truncated manifest (not enough for manifest length) --FILE-- "; $file .= pack('V', 500) . 'notenough'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; ?> +--CLEAN-- + --EXPECTF-- Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (truncated manifest) in %s on line %d \ No newline at end of file diff --git a/ext/phar/tests/009.phpt b/ext/phar/tests/009.phpt index 4667c980ef..476b41a112 100644 --- a/ext/phar/tests/009.phpt +++ b/ext/phar/tests/009.phpt @@ -4,14 +4,14 @@ Phar::mapPhar too many manifest entries --FILE-- "; $file .= pack('VV', 500, 500) . str_repeat('A', 500); -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; ?> +--CLEAN-- + --EXPECTF-- Fatal error: Phar::mapPhar(): too many manifest entries for size of manifest in phar "%s" in %s on line %d \ No newline at end of file diff --git a/ext/phar/tests/010.phpt b/ext/phar/tests/010.phpt index 9560e08f59..e308acb940 100644 --- a/ext/phar/tests/010.phpt +++ b/ext/phar/tests/010.phpt @@ -4,17 +4,17 @@ Phar::mapPhar buffer overrun --FILE-- "; $manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 1); // this fails because the manifest length does not include the 4-byte "length of manifest" data $file .= pack('VV', strlen($manifest), 1) . $manifest . pack('VV', crc32('a'), 1) . 'a'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; echo file_get_contents('phar://hio/a'); ?> +--CLEAN-- + --EXPECTF-- Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (buffer overrun) in %s on line %d \ No newline at end of file diff --git a/ext/phar/tests/011.phpt b/ext/phar/tests/011.phpt index 3738e66c57..db1af1844e 100644 --- a/ext/phar/tests/011.phpt +++ b/ext/phar/tests/011.phpt @@ -4,17 +4,17 @@ Phar::mapPhar filesize too small in manifest --FILE-- "; // compressed file length does not include 8 bytes for crc/file length and should $manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 1); $file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('a'), 1) . 'a'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; echo file_get_contents('phar://hio/a'); ?> +--CLEAN-- + --EXPECTF-- Fatal error: Phar::mapPhar(): internal corruption of phar "%s" (file size in phar is not large enough) in %s on line %d \ No newline at end of file diff --git a/ext/phar/tests/012.phpt b/ext/phar/tests/012.phpt index 0dd9fdafe6..0e05d86936 100644 --- a/ext/phar/tests/012.phpt +++ b/ext/phar/tests/012.phpt @@ -4,16 +4,16 @@ Phar::mapPhar valid file --FILE-- "; $manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9); $file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('a'), 1) . 'a'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; echo file_get_contents('phar://hio/a'); ?> +--CLEAN-- + --EXPECT-- a \ No newline at end of file diff --git a/ext/phar/tests/013.phpt b/ext/phar/tests/013.phpt index 1cd95a5df1..0dccce4ccf 100644 --- a/ext/phar/tests/013.phpt +++ b/ext/phar/tests/013.phpt @@ -4,17 +4,17 @@ Phar::mapPhar filesize mismatch --FILE-- "; // filesize should be 1, and is 2 $manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9); $file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('a'), 2) . 'a'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; echo file_get_contents('phar://hio/a'); ?> +--CLEAN-- + --EXPECTF-- -Warning: file_get_contents(phar://hio/a): failed to open stream: phar error: internal corruption of phar "%s" (filesize mismatch on file "a") in %s on line 12 \ No newline at end of file +Warning: file_get_contents(phar://hio/a): failed to open stream: phar error: internal corruption of phar "%s" (filesize mismatch on file "a") in %s on line %d diff --git a/ext/phar/tests/014.phpt b/ext/phar/tests/014.phpt index a201f8c60a..d930b72cf3 100644 --- a/ext/phar/tests/014.phpt +++ b/ext/phar/tests/014.phpt @@ -4,17 +4,17 @@ Phar::mapPhar filesize mismatch --FILE-- "; // 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'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; echo file_get_contents('phar://hio/a'); ?> +--CLEAN-- + --EXPECTF-- -Warning: file_get_contents(phar://hio/a): failed to open stream: phar error: internal corruption of phar "%s" (crc32 mismatch on file "a") in %s on line 12 \ No newline at end of file +Warning: file_get_contents(phar://hio/a): failed to open stream: phar error: internal corruption of phar "%s" (crc32 mismatch on file "a") in %s on line %d \ No newline at end of file diff --git a/ext/phar/tests/015.phpt b/ext/phar/tests/015.phpt index f6de045cb6..846f44c563 100644 --- a/ext/phar/tests/015.phpt +++ b/ext/phar/tests/015.phpt @@ -5,16 +5,16 @@ Phar::mapPhar valid file (gzipped) if (!PHP_Archive::canCompress()) print "skip"; ?> --FILE-- "; $manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 11); $file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('a'), 1) . chr(75) . chr(4) . chr(0); // 'a' gzdeflated -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; echo file_get_contents('phar://hio/a'); ?> +--CLEAN-- + --EXPECT-- a \ No newline at end of file diff --git a/ext/phar/tests/016.phpt b/ext/phar/tests/016.phpt index 58d7671af3..42f9af83b3 100644 --- a/ext/phar/tests/016.phpt +++ b/ext/phar/tests/016.phpt @@ -5,17 +5,17 @@ Phar::mapPhar invalid file (gzipped file length is too short) if (!PHP_Archive::canCompress()) print "skip"; ?> --FILE-- "; // file length is too short $manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9); $file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('a'), 1) . chr(0) . chr(4) . chr(0); // 'a' gzdeflated -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; echo file_get_contents('phar://hio/a'); ?> +--CLEAN-- + --EXPECTF-- Warning: file_get_contents(phar://hio/a): failed to open stream: phar error: decompression failed in %s on line %d \ No newline at end of file diff --git a/ext/phar/tests/017.phpt b/ext/phar/tests/017.phpt index cac6023c0f..01626039ca 100644 --- a/ext/phar/tests/017.phpt +++ b/ext/phar/tests/017.phpt @@ -4,17 +4,17 @@ Phar: opendir test - no dir specified at all --FILE-- "; // file length is too short $manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9); $file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('a'), 1) . 'a'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $dir = opendir('phar://hio'); ?> +--CLEAN-- + --EXPECTF-- Warning: opendir(phar://hio): failed to open dir: phar error: no directory in "phar://hio", must have at least phar://hio/ for root directory in %s on line %d \ No newline at end of file diff --git a/ext/phar/tests/018.phpt b/ext/phar/tests/018.phpt index 1032afe4bf..664fde6f45 100644 --- a/ext/phar/tests/018.phpt +++ b/ext/phar/tests/018.phpt @@ -4,8 +4,6 @@ Phar: opendir test, root directory --FILE-- "; @@ -16,14 +14,16 @@ $file .= pack('VV', strlen($manifest) + 4, 2) . $manifest . pack('VV', crc32('a'), 1) . 'a' . pack('VV', crc32('b'), 1) . 'b'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $dir = opendir('phar://hio/'); while (false !== ($a = readdir($dir))) { var_dump($a); var_dump(is_dir('phar://hio/' . $a)); } ?> +--CLEAN-- + --EXPECT-- string(1) "a" bool(false) diff --git a/ext/phar/tests/019.phpt b/ext/phar/tests/019.phpt index 8ff74ef7b2..0b6bba97b9 100644 --- a/ext/phar/tests/019.phpt +++ b/ext/phar/tests/019.phpt @@ -4,8 +4,6 @@ Phar: opendir test, subdirectory --FILE-- "; @@ -20,14 +18,16 @@ $file .= pack('VV', strlen($manifest) + 4, 4) . pack('VV', crc32('b'), 1) . 'b'; pack('VV', crc32('c'), 1) . 'c'; pack('VV', crc32('d'), 1) . 'd'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $dir = opendir('phar://hio/b'); while (false !== ($a = readdir($dir))) { var_dump($a); var_dump(is_dir('phar://hio/b/' . $a)); } ?> +--CLEAN-- + --EXPECT-- string(1) "a" bool(false) diff --git a/ext/phar/tests/019b.phpt b/ext/phar/tests/019b.phpt index 218e519379..8c8bb09442 100755 --- a/ext/phar/tests/019b.phpt +++ b/ext/phar/tests/019b.phpt @@ -4,8 +4,6 @@ Phar: opendir test, recurse into --FILE-- "; @@ -20,8 +18,8 @@ $file .= pack('VV', strlen($manifest) + 4, 4) . pack('VV', crc32('b'), 1) . 'b'; pack('VV', crc32('c'), 1) . 'c'; pack('VV', crc32('d'), 1) . 'd'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; function dump($phar, $base) { @@ -45,6 +43,8 @@ function dump($phar, $base) dump('phar://hio', '/'); ?> +--CLEAN-- + --EXPECT-- string(11) "phar://hio/" string(2) "/a" diff --git a/ext/phar/tests/019c.phpt b/ext/phar/tests/019c.phpt index 0e690a97cd..e940038419 100755 --- a/ext/phar/tests/019c.phpt +++ b/ext/phar/tests/019c.phpt @@ -18,8 +18,8 @@ $file .= pack('VV', strlen($manifest) + 4, 4) . pack('VV', crc32('b'), 1) . 'b' . pack('VV', crc32('c'), 1) . 'c' . pack('VV', crc32('d'), 1) . 'd'; -file_put_contents(dirname(__FILE__) . '/019c.phar.php', $file); -include dirname(__FILE__) . '/019c.phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; function dump($phar, $base) { @@ -48,7 +48,7 @@ dump('phar://hio', '/'); ?> --CLEAN-- - + --EXPECT-- string(11) "phar://hio/" string(2) "/a" diff --git a/ext/phar/tests/020.phpt b/ext/phar/tests/020.phpt index e97463e697..64c5a71f8e 100644 --- a/ext/phar/tests/020.phpt +++ b/ext/phar/tests/020.phpt @@ -4,8 +4,6 @@ Phar: url stat --FILE-- "; @@ -20,10 +18,12 @@ $file .= pack('VV', strlen($manifest) + 4, 4) . pack('VV', crc32('b'), 1) . 'b'; pack('VV', crc32('c'), 1) . 'c'; pack('VV', crc32('d'), 1) . 'd'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; var_dump(stat('phar://hio/a'), stat('phar://hio/b')); ?> +--CLEAN-- + --EXPECTF-- array(26) { [0]=> diff --git a/ext/phar/tests/021.phpt b/ext/phar/tests/021.phpt index 791e0fc4e5..5bfced3bd0 100644 --- a/ext/phar/tests/021.phpt +++ b/ext/phar/tests/021.phpt @@ -4,8 +4,6 @@ Phar: stream stat --FILE-- "; @@ -20,12 +18,14 @@ $file .= pack('VV', strlen($manifest) + 4, 4) . pack('VV', crc32('b'), 1) . 'b'; pack('VV', crc32('c'), 1) . 'c'; pack('VV', crc32('d'), 1) . 'd'; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $fp = fopen('phar://hio/a', 'r'); var_dump(fstat($fp)); fclose($fp); ?> +--CLEAN-- + --EXPECTF-- array(26) { [0]=> diff --git a/ext/phar/tests/022.phpt b/ext/phar/tests/022.phpt index e2769e4b46..d1c83eb20a 100644 --- a/ext/phar/tests/022.phpt +++ b/ext/phar/tests/022.phpt @@ -4,8 +4,6 @@ Phar: stream stat --FILE-- "; @@ -14,8 +12,8 @@ $manifest = pack('V', 1) . 'a' . pack('VVVV', strlen($contents), time(), 0, 8 + $file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32($contents), strlen($contents)) . $contents; -file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); -include dirname(__FILE__) . '/008_phar.php'; +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); +include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $fp = fopen('phar://hio/a', 'r'); var_dump(ftell($fp)); echo 'fseek($fp, 1)';var_dump(fseek($fp, 1)); @@ -61,6 +59,8 @@ echo 'fseek($fp, 3, SEEK_CUR)';var_dump(fseek($fp, 3, SEEK_CUR)); var_dump(ftell($fp)); fclose($fp); ?> +--CLEAN-- + --EXPECT-- int(0) fseek($fp, 1)int(0) @@ -100,13 +100,3 @@ int(0) int(4) fseek($fp, 3, SEEK_CUR)int(0) int(7) - - - - - - - - - -