xref: /PHP-7.2/sapi/cli/tests/bug71624.phpt (revision 68ebfc87)
1--TEST--
2Bug #61977 Test that -R properly sets argi and argn
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9
10$php = getenv('TEST_PHP_EXECUTABLE');
11
12$filename_txt = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71624.test.txt";
13
14$txt = 'foo
15test
16hello
17';
18
19file_put_contents($filename_txt, $txt);
20
21$test_args = ['$argi', '$argn'];
22foreach ($test_args as $test_arg) {
23	if (substr(PHP_OS, 0, 3) == 'WIN') {
24		var_dump(`type "$filename_txt" | "$php" -n -R "echo $test_arg . PHP_EOL;"`);
25	} else {
26		var_dump(`cat "$filename_txt" | "$php" -n -R 'echo $test_arg . PHP_EOL;'`);
27	}
28}
29
30@unlink($filename_txt);
31
32echo "Done\n";
33?>
34--EXPECT--
35string(6) "1
362
373
38"
39string(15) "foo
40test
41hello
42"
43Done
44