diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt index f8d4c28338e35..c7b872c6f37f3 100644 --- a/ext/standard/tests/general_functions/head.phpt +++ b/ext/standard/tests/general_functions/head.phpt @@ -3,45 +3,51 @@ header() and friends --FILE-- --EXPECTF-- -NULL bool(false) -array(0) { +array(1) { + [0]=> + string(%d) "X-Powered-By: PHP/%s" +} +array(2) { + [0]=> + string(%d) "X-Powered-By: PHP/%s" + [1]=> + string(8) "HTTP 1.1" +} +array(3) { + [0]=> + string(%d) "X-Powered-By: PHP/%s" + [1]=> + string(8) "HTTP 1.1" + [2]=> + string(35) "Date: Mon, 25 Mar 1985 00:20:00 GMT" } - -Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d -NULL - -Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d -NULL -bool(true) array(0) { } Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d -NULL - -Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d -NULL -bool(true) -array(0) { -} Done diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 9444f3d6253aa..7a39b59011a06 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -373,12 +373,6 @@ static char* sapi_cli_read_cookies(void) /* {{{ */ } /* }}} */ -static int sapi_cli_header_handler(sapi_header_struct *h, sapi_header_op_enum op, sapi_headers_struct *s) /* {{{ */ -{ - return 0; -} -/* }}} */ - static int sapi_cli_send_headers(sapi_headers_struct *sapi_headers) /* {{{ */ { /* We do nothing here, this function is needed to prevent that the fallback @@ -430,7 +424,7 @@ static sapi_module_struct cli_sapi_module = { php_error, /* error handler */ - sapi_cli_header_handler, /* header handler */ + NULL, /* header handler */ sapi_cli_send_headers, /* send headers handler */ sapi_cli_send_header, /* send header handler */ diff --git a/sapi/cli/tests/cli_header_handler.phpt b/sapi/cli/tests/cli_header_handler.phpt new file mode 100644 index 0000000000000..a64458dcf269f --- /dev/null +++ b/sapi/cli/tests/cli_header_handler.phpt @@ -0,0 +1,35 @@ +--TEST-- +CLI header(), header_remove() and headers_list() +--SKIPIF-- + +--INI-- +expose_php=On +--FILE-- + +--EXPECTF-- +Array +( + [0] => X-Powered-By: %s + [1] => A: second +) +Array +( + [0] => X-Powered-By: %s + [1] => A: second + [2] => A: third +) +Array +( + [0] => X-Powered-By: %s +) diff --git a/sapi/cli/tests/cli_header_session.phpt b/sapi/cli/tests/cli_header_session.phpt new file mode 100644 index 0000000000000..534e4f8b7ebc9 --- /dev/null +++ b/sapi/cli/tests/cli_header_session.phpt @@ -0,0 +1,24 @@ +--TEST-- +CLI session create header +--SKIPIF-- + +--INI-- +expose_php=On +--FILE-- + +--EXPECTF-- +Array +( + [0] => X-Powered-By: %s + [1] => Set-Cookie: foo=bar; path=/ + [2] => Expires: %s + [3] => Cache-Control: no-store, no-cache, must-revalidate + [4] => Pragma: no-cache +) diff --git a/sapi/cli/tests/cli_header_setcookie.phpt b/sapi/cli/tests/cli_header_setcookie.phpt new file mode 100644 index 0000000000000..05669047f791b --- /dev/null +++ b/sapi/cli/tests/cli_header_setcookie.phpt @@ -0,0 +1,22 @@ +--TEST-- +CLI setcookie() create header +--SKIPIF-- + +--INI-- +expose_php=On +--FILE-- + +--EXPECTF-- +Array +( + [0] => X-Powered-By: %s + [1] => Set-Cookie: hi=%s + [2] => Set-Cookie: hi=deleted;%s +) diff --git a/sapi/cli/tests/cli_headers_sent.phpt b/sapi/cli/tests/cli_headers_sent.phpt new file mode 100644 index 0000000000000..8f6c72da617ad --- /dev/null +++ b/sapi/cli/tests/cli_headers_sent.phpt @@ -0,0 +1,35 @@ +--TEST-- +CLI headers_sent() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Hi !!Bye !! +bool(false) +bool(false) +bool(false) +bool(false) +bool(true)