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

73 lines
1.2 KiB
PHP

--TEST--
Bug #64529 (Ran out of opcode space)
--EXTENSIONS--
readline
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == "WIN") {
die("skip non windows test");
}
if (!readline_info("done")) {
die("skip readline support required");
}
exec('which expect', $output, $ret);
if ($ret) {
die("skip no expect installed");
}
?>
--FILE--
<?php
$expect_executable = trim(`which expect`);
$php_executable = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
$script = __DIR__ . "/expect.sh";
if (extension_loaded("readline")) {
$expect_script = <<<SCRIPT
set php_executable [lindex \$argv 0]
spawn \$php_executable -n -d cli.prompt="" -a
expect "php >"
send "echo 'hello world';\n"
send "\04"
expect eof
exit
SCRIPT;
} else {
$expect_script = <<<SCRIPT
set php_executable [lindex \$argv 0]
spawn \$php_executable -n -d cli.prompt="" -a
expect "Interactive mode enabled"
send "<?php echo 'hello world';\n"
send "\04"
expect eof
exit
SCRIPT;
}
file_put_contents($script, $expect_script);
system($expect_executable . " " . $script . " " . $php_executable);
@unlink($script);
?>
--EXPECTF--
spawn %sphp -n -d cli.prompt="" -a
Interactive %s
%Secho 'hello world';
%Shello world