xref: /PHP-7.1/sapi/cli/tests/021.phpt (revision 7af945e2)
1--TEST--
2CLI shell shebang
3--SKIPIF--
4<?php
5include 'skipif.inc';
6if (substr(PHP_OS, 0, 3) == 'WIN') {
7	die ("skip not for Windows");
8}
9
10if (strlen("#!".getenv('TEST_PHP_EXECUTABLE')) > 127) {
11        die ("skip shebang is too long, see http://www.in-ulm.de/~mascheck/various/shebang/#results");
12}
13?>
14--FILE--
15<?php
16
17$php = getenv('TEST_PHP_EXECUTABLE');
18
19$filename = __DIR__.'/021.tmp.php';
20
21$script = "#!$php -n\n".
22          "ola\n".
23          "<?php echo 1+1,'\n';\n".
24          "?>\n".
25          "adeus\n";
26
27file_put_contents($filename, $script);
28chmod($filename, 0777);
29
30echo `$filename`;
31
32echo "\nDone\n";
33?>
34--CLEAN--
35<?php
36unlink(__DIR__.'/021.tmp.php');
37?>
38--EXPECTF--
39ola
402
41adeus
42
43Done
44