--FILE--
<?php
include "php_cli_server.inc";
-php_cli_server_start('<?php ?>', true);
+php_cli_server_start('<?php ?>', null);
/*
* If a Mime Type is added in php_cli_server.c, add it to this array and update
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) {
+function php_cli_server_start($code = 'echo "Hello world";', $router = 'index.php') {
$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(
if (substr(PHP_OS, 0, 3) == 'WIN') {
$cmd = "{$php_executable} -t {$doc_root} -n -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 -S " . PHP_CLI_SERVER_ADDRESS;
- if (!$no_router) {
+ if (!is_null($router)) {
$cmd .= " {$router}";
}
$cmd .= " 2>/dev/null";
--FILE--
<?php
include "php_cli_server.inc";
-php_cli_server_start('var_dump($_SERVER["PATH_INFO"]);', TRUE);
+php_cli_server_start('var_dump($_SERVER["PATH_INFO"]);', null);
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;
--FILE--
<?php
include "php_cli_server.inc";
-php_cli_server_start('var_dump($_SERVER["PHP_SELF"], $_SERVER["SCRIPT_NAME"], $_SERVER["PATH_INFO"], $_SERVER["QUERY_STRING"]);', TRUE);
+php_cli_server_start('var_dump($_SERVER["PHP_SELF"], $_SERVER["SCRIPT_NAME"], $_SERVER["PATH_INFO"], $_SERVER["QUERY_STRING"]);', null);
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;
--FILE--
<?php
include "php_cli_server.inc";
-php_cli_server_start(NULL, TRUE);
+php_cli_server_start(NULL, NULL);
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;
--FILE--
<?php
include "php_cli_server.inc";
-php_cli_server_start('echo done, "\n";', TRUE);
+php_cli_server_start('echo done, "\n";', null);
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;