blob: 0b90844f373f2ccb8ee3a96622f79f91c6ba97a8 (
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
--TEST--
CLI -a and readline
--SKIPIF--
<?php
include "skipif.inc";
if (!extension_loaded('readline') || readline_info('done') === NULL) {
die ("skip need readline support");
}
?>
--FILE--
<?php
$php = getenv('TEST_PHP_EXECUTABLE');
$codes = array();
$codes[1] = <<<EOT
echo 'Hello world';
exit
EOT;
$codes[] = <<<EOT
echo 'multine
single
quote';
exit
EOT;
$codes[] = <<<EOT
echo <<<HEREDOC
Here
comes
the
doc
HEREDOC;
EOT;
$codes[] = <<<EOT
if (0) {
echo "I'm not there";
}
echo "Done";
EOT;
$codes[] = <<<EOT
function a_function_with_some_name() {
echo "I was called!";
}
a_function_w );
EOT;
foreach ($codes as $key => $code) {
echo "\n--------------\nSnippet no. $key:\n--------------\n";
$code = escapeshellarg($code);
echo `echo $code | "$php" -a`, "\n";
}
echo "\nDone\n";
?>
--EXPECTF--
--------------
Snippet no. 1:
--------------
Interactive shell
php > Hello world
php >
--------------
Snippet no. 2:
--------------
Interactive shell
php > php ' php ' multine
single
quote
php >
--------------
Snippet no. 3:
--------------
Interactive shell
php > <<< > <<< > <<< > <<< > <<< > Here
comes
the
doc
php >
--------------
Snippet no. 4:
--------------
Interactive shell
php > php { php { php > Done
php >
--------------
Snippet no. 5:
--------------
Interactive shell
php > php { php { php > I was called!
php >
Done
|