From: Adam Harvey Date: Tue, 6 Jan 2015 01:27:37 +0000 (+0000) Subject: Merge branch 'PHP-5.5' into PHP-5.6 X-Git-Tag: php-5.6.5RC1~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27ff425b78a1355a24d44eb719291ebd9022bc87;p=php 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 --- 27ff425b78a1355a24d44eb719291ebd9022bc87 diff --cc sapi/cli/tests/bug68745.phpt index 0000000000,f52e6bcc74..733d7d0900 mode 000000,100644..100644 --- a/sapi/cli/tests/bug68745.phpt +++ b/sapi/cli/tests/bug68745.phpt @@@ -1,0 -1,34 +1,34 @@@ + --TEST-- + Bug #68745 (Invalid HTTP requests make web server segfault) + --SKIPIF-- + + --FILE-- + + --EXPECTF-- + HTTP/1.1 200 OK + Connection: close + X-Powered-By: %s -Content-type: text/html ++Content-type: text/html; charset=UTF-8 + + int(%d) diff --cc sapi/cli/tests/php_cli_server.inc index 77a79e0f04,c7222b4f25..6b1e90c4dc --- a/sapi/cli/tests/php_cli_server.inc +++ b/sapi/cli/tests/php_cli_server.inc @@@ -3,13 -3,12 +3,12 @@@ define ("PHP_CLI_SERVER_HOSTNAME", "loc 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') { ++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, ''); + file_put_contents($doc_root . '/' . ($router ?: 'index.php'), ''); } $descriptorspec = array( @@@ -19,15 -18,15 +18,15 @@@ ); if (substr(PHP_OS, 0, 3) == 'WIN') { - $cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CLI_SERVER_ADDRESS; + $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 -S " . PHP_CLI_SERVER_ADDRESS; + $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";