summaryrefslogtreecommitdiff
path: root/sapi/cli/tests/bug71624.phpt
blob: 67e3e8f343d6678f82484176f2058c72b69cf8b4 (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
--TEST--
Bug #61977 Test that -R properly sets argi and argn
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php

$php = getenv('TEST_PHP_EXECUTABLE');

$filename_txt = __DIR__ . DIRECTORY_SEPARATOR . "bug71624.test.txt";

$txt = 'foo
test
hello
';

file_put_contents($filename_txt, $txt);

$test_args = ['$argi', '$argn'];
foreach ($test_args as $test_arg) {
	if (substr(PHP_OS, 0, 3) == 'WIN') {
		var_dump(`type "$filename_txt" | "$php" -n -R "echo $test_arg . PHP_EOL;"`);
	} else {
		var_dump(`cat "$filename_txt" | "$php" -n -R 'echo $test_arg . PHP_EOL;'`);
	}
}

@unlink($filename_txt);

echo "Done\n";
?>
--EXPECT--
string(6) "1
2
3
"
string(15) "foo
test
hello
"
Done