Annotation of embedaddon/php/ext/phar/tests/tar/bignames.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: tar with huge filenames
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.require_hash=0
7: --FILE--
8: <?php
9: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.tar';
10: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.tar';
11: $fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.3.tar';
12: $fname4 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.4.tar';
13: $pname = 'phar://' . $fname;
14:
15: $p1 = new PharData($fname);
16: $p1[str_repeat('a', 100) . '/b'] = 'hi';
17: $p1[str_repeat('a', 155) . '/' . str_repeat('b', 100)] = 'hi2';
18: copy($fname, $fname2);
19: $p2 = new PharData($fname2);
20: echo $p2[str_repeat('a', 100) . '/b']->getContent() . "\n";
21: echo $p2[str_repeat('a', 155) . '/' . str_repeat('b', 100)]->getContent() . "\n";
22:
23: try {
24: $p2[str_repeat('a', 400)] = 'yuck';
25: } catch (Exception $e) {
26: echo $e->getMessage() . "\n";
27: }
28:
29: try {
30: $p2 = new PharData($fname3);
31: $p2[str_repeat('a', 101)] = 'yuck';
32: } catch (Exception $e) {
33: echo $e->getMessage() . "\n";
34: }
35:
36: try {
37: $p2 = new PharData($fname4);
38: $p2[str_repeat('b', 160) . '/' . str_repeat('a', 90)] = 'yuck';
39: } catch (Exception $e) {
40: echo $e->getMessage() . "\n";
41: }
42: ?>
43: ===DONE===
44: --CLEAN--
45: <?php
46: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar');
47: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.tar');
48: @unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.3.tar');
49: @unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.4.tar');
50: ?>
51: --EXPECTF--
52: hi
53: hi2
54: tar-based phar "%sbignames.2.tar" cannot be created, filename "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is too long for tar file format
55: tar-based phar "%sbignames.3.tar" cannot be created, filename "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is too long for tar file format
56: tar-based phar "%sbignames.4.tar" cannot be created, filename "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is too long for tar file format
57: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>