diff options
author | Adam Harvey <aharvey@php.net> | 2015-01-06 01:29:40 +0000 |
---|---|---|
committer | Adam Harvey <aharvey@php.net> | 2015-01-06 01:29:40 +0000 |
commit | a607a1db1d16f62feac06c136c1bf435c3e55a9d (patch) | |
tree | c85e179ce8d6a09df12ba9f3143c540e090b933b /sapi/cli/tests/php_cli_server.inc | |
parent | bb7ceb046eb5f0d5fa25066a3d7f9b4eb8cc3c93 (diff) | |
parent | 27ff425b78a1355a24d44eb719291ebd9022bc87 (diff) | |
download | php-git-a607a1db1d16f62feac06c136c1bf435c3e55a9d.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
Handle NULL strings in sapi_cli_server_register_variable().
Allow CLI server test scripts to specify the name of the router file.
Conflicts:
sapi/cli/php_cli_server.c
Diffstat (limited to 'sapi/cli/tests/php_cli_server.inc')
-rw-r--r-- | sapi/cli/tests/php_cli_server.inc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc index 77a79e0f04..6b1e90c4dc 100644 --- a/sapi/cli/tests/php_cli_server.inc +++ b/sapi/cli/tests/php_cli_server.inc @@ -3,13 +3,12 @@ define ("PHP_CLI_SERVER_HOSTNAME", "localhost"); define ("PHP_CLI_SERVER_PORT", 8964); define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT); -function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE, $cmd_args = null) { +function php_cli_server_start($code = 'echo "Hello world";', $router = 'index.php', $cmd_args = null) { $php_executable = getenv('TEST_PHP_EXECUTABLE'); $doc_root = __DIR__; - $router = "index.php"; if ($code) { - file_put_contents($doc_root . '/' . $router, '<?php ' . $code . ' ?>'); + file_put_contents($doc_root . '/' . ($router ?: 'index.php'), '<?php ' . $code . ' ?>'); } $descriptorspec = array( @@ -20,14 +19,14 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE, if (substr(PHP_OS, 0, 3) == 'WIN') { $cmd = "{$php_executable} -t {$doc_root} -n {$cmd_args} -S " . PHP_CLI_SERVER_ADDRESS; - if (!$no_router) { + if (!is_null($router)) { $cmd .= " {$router}"; } $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true)); } else { $cmd = "exec {$php_executable} -t {$doc_root} -n {$cmd_args} -S " . PHP_CLI_SERVER_ADDRESS; - if (!$no_router) { + if (!is_null($router)) { $cmd .= " {$router}"; } $cmd .= " 2>/dev/null"; |