diff options
author | Adam Harvey <aharvey@php.net> | 2015-01-06 01:27:37 +0000 |
---|---|---|
committer | Adam Harvey <aharvey@php.net> | 2015-01-06 01:27:37 +0000 |
commit | 27ff425b78a1355a24d44eb719291ebd9022bc87 (patch) | |
tree | 82e135b0e14397272bf28ff13548c13d7ce9c8dd /sapi/cli/tests/php_cli_server.inc | |
parent | 4756207e7ef9fcaa80039f5cf2f6b8f8935bf66b (diff) | |
parent | 448ef30f75988384b84cdb88bbb3a1a56b9534da (diff) | |
download | php-git-27ff425b78a1355a24d44eb719291ebd9022bc87.tar.gz |
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
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/tests/php_cli_server.inc
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"; |