1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/sapi/cli/tests/bug71624.phpt
Niels Dossche dcc3255b18 Fix GH-10489: run-tests.php does not escape path when building cmd (#10560)
Multiple tests had to be changed to escape the arguments in shell
commands. Some tests are skipped because they behave differently with
spaces in the path versus without. One notable example of this is the
hashbang test which does not work because spaces in hashbangs paths are
not supported in Linux.

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
2023-02-25 14:02:06 +00:00

45 lines
775 B
PHP

--TEST--
Bug #61977 Test that -R properly sets argi and argn
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
$filename_txt = __DIR__ . DIRECTORY_SEPARATOR . "bug71624.test.txt";
$filename_txt_escaped = escapeshellarg($filename_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_escaped | $php -n -R "echo $test_arg . PHP_EOL;"`);
} else {
var_dump(`cat $filename_txt_escaped | $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