diff options
| author | Igor Pashev <pashev.igor@gmail.com> | 2015-02-20 22:25:42 +0300 |
|---|---|---|
| committer | Igor Pashev <pashev.igor@gmail.com> | 2015-02-20 22:25:42 +0300 |
| commit | 71d41ca6bb3a9d888b39f34a30f994ac1cf88873 (patch) | |
| tree | 3a11365b77b332c078440204fb82549d34237a35 /sapi/cli/tests | |
| parent | 2d50280dd013556e51b6f275ca965fe7b530029b (diff) | |
| parent | 1ceec3a053647865493ab417d3ce401b9bc42450 (diff) | |
| download | php-71d41ca6bb3a9d888b39f34a30f994ac1cf88873.tar.gz | |
Merge branch 'master-5.6' of git://anonscm.debian.org/pkg-php/php
Conflicts:
debian/changelog
debian/patches/series
Diffstat (limited to 'sapi/cli/tests')
| -rw-r--r-- | sapi/cli/tests/016.phpt | 2 | ||||
| -rw-r--r-- | sapi/cli/tests/bug61977.phpt | 2 | ||||
| -rw-r--r-- | sapi/cli/tests/bug64529.phpt | 10 | ||||
| -rw-r--r-- | sapi/cli/tests/bug68745.phpt | 34 | ||||
| -rw-r--r-- | sapi/cli/tests/php_cli_server.inc | 9 | ||||
| -rw-r--r-- | sapi/cli/tests/php_cli_server_009.phpt | 2 | ||||
| -rw-r--r-- | sapi/cli/tests/php_cli_server_010.phpt | 2 | ||||
| -rw-r--r-- | sapi/cli/tests/php_cli_server_013.phpt | 2 | ||||
| -rw-r--r-- | sapi/cli/tests/php_cli_server_014.phpt | 2 |
9 files changed, 48 insertions, 17 deletions
diff --git a/sapi/cli/tests/016.phpt b/sapi/cli/tests/016.phpt index 31c1a40e4..9c28d15a3 100644 --- a/sapi/cli/tests/016.phpt +++ b/sapi/cli/tests/016.phpt @@ -59,8 +59,6 @@ foreach ($codes as $key => $code) { echo "\nDone\n"; ?> ---XFAIL-- -https://bugs.php.net/bug.php?id=55496 --EXPECTF-- -------------- Snippet no. 1: diff --git a/sapi/cli/tests/bug61977.phpt b/sapi/cli/tests/bug61977.phpt index 09a6ba6d2..d897737c3 100644 --- a/sapi/cli/tests/bug61977.phpt +++ b/sapi/cli/tests/bug61977.phpt @@ -7,7 +7,7 @@ include "skipif.inc"; --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 diff --git a/sapi/cli/tests/bug64529.phpt b/sapi/cli/tests/bug64529.phpt index d3755724e..8452953ba 100644 --- a/sapi/cli/tests/bug64529.phpt +++ b/sapi/cli/tests/bug64529.phpt @@ -21,7 +21,7 @@ if (extension_loaded("readline")) { set php_executable [lindex \$argv 0] -spawn \$php_executable -n -a +spawn \$php_executable -n -d cli.prompt="" -a expect "php >" @@ -39,7 +39,7 @@ SCRIPT; set php_executable [lindex \$argv 0] -spawn \$php_executable -n -a +spawn \$php_executable -n -d cli.prompt="" -a expect "Interactive mode enabled" @@ -60,8 +60,8 @@ system($expect_executable . " " . $script . " " . $php_executable); @unlink($script); ?> --EXPECTF-- -spawn %sphp -n -a +spawn %sphp -n -d cli.prompt="" -a Interactive %s -%secho 'hello world'; -%sello worl%s +%Secho 'hello world'; +%Shello world diff --git a/sapi/cli/tests/bug68745.phpt b/sapi/cli/tests/bug68745.phpt new file mode 100644 index 000000000..733d7d090 --- /dev/null +++ b/sapi/cli/tests/bug68745.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #68745 (Invalid HTTP requests make web server segfault) +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php +include "php_cli_server.inc"; +php_cli_server_start('var_dump(count($_SERVER));', 'not-index.php'); + +list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); +$port = intval($port)?:80; + +$fp = fsockopen($host, $port, $errno, $errstr, 0.5); +if (!$fp) { + die("connect failed"); +} + +if(fwrite($fp, "GET www.example.com:80 HTTP/1.1\r\n\r\n")) { + while (!feof($fp)) { + echo fgets($fp); + } +} + +fclose($fp); +?> +--EXPECTF-- +HTTP/1.1 200 OK +Connection: close +X-Powered-By: %s +Content-type: text/html; charset=UTF-8 + +int(%d) diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc index 77a79e0f0..6b1e90c4d 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"; diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt index 231797160..7f3009b9b 100644 --- a/sapi/cli/tests/php_cli_server_009.phpt +++ b/sapi/cli/tests/php_cli_server_009.phpt @@ -10,7 +10,7 @@ include "skipif.inc"; --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; diff --git a/sapi/cli/tests/php_cli_server_010.phpt b/sapi/cli/tests/php_cli_server_010.phpt index 30e6d047a..ce3abeb50 100644 --- a/sapi/cli/tests/php_cli_server_010.phpt +++ b/sapi/cli/tests/php_cli_server_010.phpt @@ -7,7 +7,7 @@ include "skipif.inc"; --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; diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt index 0e3f4ff74..3ea3ea9ca 100644 --- a/sapi/cli/tests/php_cli_server_013.phpt +++ b/sapi/cli/tests/php_cli_server_013.phpt @@ -7,7 +7,7 @@ include "skipif.inc"; --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; diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt index e8bb5fa8a..4f812e2f6 100644 --- a/sapi/cli/tests/php_cli_server_014.phpt +++ b/sapi/cli/tests/php_cli_server_014.phpt @@ -7,7 +7,7 @@ include "skipif.inc"; --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; |
