diff options
Diffstat (limited to 'sapi/cli')
-rw-r--r-- | sapi/cli/php_cli.c | 10 | ||||
-rw-r--r-- | sapi/cli/tests/002-win32.phpt | 2 | ||||
-rw-r--r-- | sapi/cli/tests/022.inc | 14 | ||||
-rw-r--r-- | sapi/cli/tests/022.phpt | 47 |
4 files changed, 8 insertions, 65 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index e554051d29..66e206df62 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -260,10 +260,11 @@ static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ { ret = sapi_cli_single_write(ptr, remaining); if (!ret) { -#ifndef PHP_CLI_WIN32_NO_CONSOLE +#ifdef PHP_CLI_WIN32_NO_CONSOLE + break; +#else php_handle_aborted_connection(); #endif - break; } ptr += ret; remaining -= ret; @@ -346,8 +347,11 @@ static char* sapi_cli_read_cookies(TSRMLS_D) /* {{{ */ } /* }}} */ -static int sapi_cli_header_handler(sapi_header_struct *h, sapi_header_op_enum op, sapi_headers_struct *s TSRMLS_DC) /* {{{ */ +static int sapi_cli_header_handler(sapi_header_struct *h, sapi_headers_struct *s TSRMLS_DC) /* {{{ */ { + /* free allocated header line */ + efree(h->header); + /* avoid pushing headers into SAPI headers list */ return 0; } /* }}} */ diff --git a/sapi/cli/tests/002-win32.phpt b/sapi/cli/tests/002-win32.phpt index 5a00c67f74..ca0e66ddcd 100644 --- a/sapi/cli/tests/002-win32.phpt +++ b/sapi/cli/tests/002-win32.phpt @@ -10,7 +10,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') { --FILE-- <?php -$php = getenv('TEST_PHP_EXECUTABLE'); +$php = $_ENV['TEST_PHP_EXECUTABLE']; var_dump(`$php -n -r "var_dump('hello');"`); diff --git a/sapi/cli/tests/022.inc b/sapi/cli/tests/022.inc deleted file mode 100644 index b77512fcf3..0000000000 --- a/sapi/cli/tests/022.inc +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -ob_start(); -var_dump(STDIN); - -$fd = fopen("php://stdin","r"); -var_dump($fd); - -$client_socket = stream_socket_accept($fd); - -$data = ob_get_clean(); -fwrite($client_socket, $data); - -?> diff --git a/sapi/cli/tests/022.phpt b/sapi/cli/tests/022.phpt deleted file mode 100644 index eabb8bdf8d..0000000000 --- a/sapi/cli/tests/022.phpt +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -STDIN/OUT/ERR stream type ---SKIPIF-- -<?php -if (!getenv("TEST_PHP_EXECUTABLE")) die("skip TEST_PHP_EXECUTABLE not set"); -if (substr(PHP_OS, 0, 3) == "WIN") die("skip non windows test"); -?> ---FILE-- -<?php -$php = getenv("TEST_PHP_EXECUTABLE"); -$socket_file = dirname(__FILE__) . '/' . pathinfo(__FILE__, PATHINFO_FILENAME) . '.sock'; -$test_file = dirname(__FILE__) . '/' . pathinfo(__FILE__, PATHINFO_FILENAME) . '.inc'; -if (file_exists($socket_file)) { - unlink($socket_file); -} -$socket = stream_socket_server('unix://' . $socket_file); -var_dump($socket); -if (!$socket) { - exit(1); -} -$desc = array( - 0 => $socket, - 1 => STDOUT, - 2 => STDERR, -); -$pipes = array(); -$proc = proc_open("$php -n " . escapeshellarg($test_file), $desc, $pipes); -var_dump($proc); -if (!$proc) { - exit(1); -} - -$client_socket = stream_socket_client('unix://' . $socket_file); -var_dump($client_socket); -echo stream_get_contents($client_socket); -fclose($client_socket); - -proc_terminate($proc); -proc_close($proc); -unlink($socket_file); -?> ---EXPECTF-- -resource(%d) of type (stream) -resource(%d) of type (process) -resource(%d) of type (stream) -resource(%d) of type (stream) -resource(%d) of type (stream) |