Files
php-src/sapi/cli/tests/012-2.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

55 lines
1.5 KiB
PHP

--TEST--
more invalid arguments and error messages
--EXTENSIONS--
readline
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
<?php
$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
// -r : behavior = CLI_DIRECT
// -F / -R / -B / -E : behavior = PROCESS_STDIN
// -l : behavior = LINT
// -s : behavior = HIGHLIGHT
// -w : behavior = STRIP
var_dump(`$php -n -r "echo 1;" -F some.php`);
var_dump(`$php -n -r "echo 2;" -f some.php`);
var_dump(`$php -n -r "echo 3;" -l`); // ignores linting
var_dump(`$php -n -r "echo 4;" -R some.php`);
var_dump(`$php -n -r "echo 5;" -B ""`);
var_dump(`$php -n -a -B ""`);
var_dump(`$php -n -r "echo 6;" -E ""`);
var_dump(`$php -n -a -E ""`);
var_dump(`$php -n -r "echo 7;" -s`);
var_dump(`$php -n -r "echo 8;" -w`);
var_dump(`$php -n -l -r "echo 9;"`);
echo "Done\n";
?>
--EXPECT--
string(57) "Either execute direct code, process stdin or use a file.
"
string(57) "Either execute direct code, process stdin or use a file.
"
string(1) "3"
string(57) "Either execute direct code, process stdin or use a file.
"
string(57) "Either execute direct code, process stdin or use a file.
"
string(57) "Either execute direct code, process stdin or use a file.
"
string(57) "Either execute direct code, process stdin or use a file.
"
string(57) "Either execute direct code, process stdin or use a file.
"
string(42) "Source highlighting only works for files.
"
string(39) "Source stripping only works for files.
"
string(57) "Either execute direct code, process stdin or use a file.
"
Done