blob: 28127e42a5f87e610609b83890f1fe1cf0e99bf7 (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
--TEST--
Phar: Phar::setDefaultStub() with and without arg, zip-based phar
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--INI--
phar.readonly=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
$phar = new Phar($fname);
$phar['a.php'] = '<php echo "this is a\n"; ?>';
$phar['b.php'] = '<php echo "this is b\n"; ?>';
$phar->setStub('<?php echo "Hello World\n"; __HALT_COMPILER(); ?>');
var_dump($phar->getStub());
echo "============================================================================\n";
echo "============================================================================\n";
try {
$phar->setDefaultStub();
$phar->stopBuffering();
} catch(Exception $e) {
echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
echo "============================================================================\n";
echo "============================================================================\n";
try {
$phar->setDefaultStub('my/custom/thingy.php');
$phar->stopBuffering();
} catch(Exception $e) {
echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
echo "============================================================================\n";
echo "============================================================================\n";
try {
$phar->setDefaultStub('my/custom/thingy.php', 'the/web.php');
$phar->stopBuffering();
} catch(Exception $e) {
echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
?>
--EXPECTF--
string(51) "<?php echo "Hello World\n"; __HALT_COMPILER(); ?>
"
============================================================================
============================================================================
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
============================================================================
============================================================================
Warning: Phar::setDefaultStub(): method accepts no arguments for a tar- or zip-based phar stub, 1 given in %sphar_setdefaultstub.php on line %d
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
============================================================================
============================================================================
Warning: Phar::setDefaultStub(): method accepts no arguments for a tar- or zip-based phar stub, 2 given in %sphar_setdefaultstub.php on line %d
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
===DONE===
|