xref: /php-src/sapi/cli/tests/010.phpt (revision dcc3255b)
1--TEST--
2executing a file with -F
3--SKIPIF--
4<?php
5include "skipif.inc";
6if (substr(PHP_OS, 0, 3) == 'WIN') {
7    die ("skip not for Windows");
8}
9?>
10--FILE--
11<?php
12
13$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
14
15$filename = __DIR__."/010.test.php";
16$filename_escaped = escapeshellarg($filename);
17$filename_txt = __DIR__."/010.test.txt";
18$filename_txt_escaped = escapeshellarg($filename_txt);
19
20$code = '
21<?php
22var_dump(fread(STDIN, 10));
23?>
24';
25
26file_put_contents($filename, $code);
27
28$txt = '
29test
30hello';
31
32file_put_contents($filename_txt, $txt);
33
34var_dump(`cat $filename_txt_escaped | $php -n -F $filename_escaped`);
35
36?>
37--CLEAN--
38<?php
39@unlink(__DIR__."/010.test.php");
40@unlink(__DIR__."/010.test.txt");
41?>
42--EXPECT--
43string(25) "
44string(10) "test
45hello"
46"
47