blob: 29e0c7b4e325f78c21183b20f0a9f4b36f442a7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
--TEST--
Bug #64931 (phar_add_file is too restrictive on filename)
--SKIPIF--
<?php extension_loaded("phar") or die("skip need ext/phar support"); ?>
--INI--
phar.readonly=0
--FILE--
<?php
echo "Test\n";
@unlink(__DIR__."/bug64931.phar");
$phar = new Phar(__DIR__."/bug64931.phar");
$phar->addFile(__DIR__."/src/.pharignore", ".pharignore");
try {
$phar->addFile(__DIR__."/src/.pharignore", ".phar/gotcha");
} catch (Exception $e) {
echo "CAUGHT: ". $e->getMessage() ."\n";
}
try {
$phar->addFromString(".phar", "gotcha");
} catch (Exception $e) {
echo "CAUGHT: ". $e->getMessage() ."\n";
}
try {
$phar->addFromString(".phar//", "gotcha");
} catch (Exception $e) {
echo "CAUGHT: ". $e->getMessage() ."\n";
}
try {
$phar->addFromString(".phar\\", "gotcha");
} catch (Exception $e) {
echo "CAUGHT: ". $e->getMessage() ."\n";
}
try {
$phar->addFromString(".phar\0", "gotcha");
} catch (Exception $e) {
echo "CAUGHT: ". $e->getMessage() ."\n";
}
?>
===DONE===
--CLEAN--
<?php
@unlink(__DIR__."/bug64931.phar");
?>
--EXPECTF--
Test
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
Warning: Phar::addFromString() expects parameter 1 to be a valid path, string given in %s/bug64931.php on line %d
===DONE===
|