summaryrefslogtreecommitdiff
path: root/sapi/cli
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cli')
-rw-r--r--sapi/cli/config.w326
-rw-r--r--sapi/cli/php_cli.c83
-rw-r--r--sapi/cli/php_cli_server.c45
-rw-r--r--sapi/cli/php_http_parser.c2
-rw-r--r--sapi/cli/ps_title.c41
-rw-r--r--sapi/cli/tests/argv_mb.phpt38
-rw-r--r--sapi/cli/tests/bug43177.phpt4
-rw-r--r--sapi/cli/tests/bug65066_100.phpt1
-rw-r--r--sapi/cli/tests/bug65066_422.phpt1
-rw-r--r--sapi/cli/tests/bug65066_511.phpt1
-rw-r--r--sapi/cli/tests/bug65633.phpt1
-rw-r--r--sapi/cli/tests/bug66606_2.phpt1
-rw-r--r--sapi/cli/tests/bug66830.phpt1
-rw-r--r--sapi/cli/tests/bug67429.phpt2
-rw-r--r--sapi/cli/tests/bug68745.phpt1
-rw-r--r--sapi/cli/tests/bug71005.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_004.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_005.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_006.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_007.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_008.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_009.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_010.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_012.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_013.phpt3
-rw-r--r--sapi/cli/tests/php_cli_server_014.phpt2
-rw-r--r--sapi/cli/tests/php_cli_server_015.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_017.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_018.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_019.phpt1
-rw-r--r--sapi/cli/tests/php_cli_server_020.phpt1
-rw-r--r--sapi/cli/tests/upload_2G.phpt1
32 files changed, 192 insertions, 59 deletions
diff --git a/sapi/cli/config.w32 b/sapi/cli/config.w32
index 664394c8a6..7d0e5954ff 100644
--- a/sapi/cli/config.w32
+++ b/sapi/cli/config.w32
@@ -8,10 +8,16 @@ ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
if (PHP_CLI == "yes") {
SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c php_cli_process_title.c ps_title.c', 'php.exe', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
ADD_FLAG("LIBS_CLI", "ws2_32.lib");
+ ADD_FLAG("LIBS_CLI", "shell32.lib");
if (PHP_CRT_DEBUG == "yes") {
ADD_FLAG("CFLAGS_CLI", "/D PHP_WIN32_DEBUG_HEAP");
}
ADD_FLAG("LDFLAGS_CLI", "/stack:67108864");
+
+ if (CHECK_LIB("edit_a.lib;edit.lib", "cli", PHP_CLI) &&
+ CHECK_HEADER_ADD_INCLUDE("editline/readline.h", "CFLAGS_CLI")) {
+ ADD_FLAG("CFLAGS_CLI", "/D HAVE_LIBEDIT");
+ }
}
if (PHP_CLI_WIN32 == "yes") {
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 978c8b332e..dc92045ae7 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -39,6 +39,7 @@
#include "win32/time.h"
#include "win32/signal.h"
#include <process.h>
+#include <shellapi.h>
#endif
#if HAVE_SYS_TIME_H
#include <sys/time.h>
@@ -102,9 +103,12 @@ PHPAPI extern char *php_ini_opened_path;
PHPAPI extern char *php_ini_scanned_path;
PHPAPI extern char *php_ini_scanned_files;
-#if defined(PHP_WIN32) && defined(ZTS)
+#if defined(PHP_WIN32)
+#if defined(ZTS)
ZEND_TSRMLS_CACHE_DEFINE()
#endif
+static DWORD orig_cp = 0;
+#endif
#ifndef O_BINARY
#define O_BINARY 0
@@ -218,8 +222,9 @@ static int print_extension_info(zend_extension *ext, void *arg) /* {{{ */
static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s) /* {{{ */
{
- return strcmp(((zend_extension *)(*f)->data)->name,
- ((zend_extension *)(*s)->data)->name);
+ zend_extension *fe = (zend_extension*)(*f)->data;
+ zend_extension *se = (zend_extension*)(*s)->data;
+ return strcmp(fe->name, se->name);
}
/* }}} */
@@ -267,11 +272,7 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length) /*
#endif
if (cli_shell_callbacks.cli_shell_write) {
- size_t shell_wrote;
- shell_wrote = cli_shell_callbacks.cli_shell_write(str, str_length);
- if (shell_wrote > -1) {
- return shell_wrote;
- }
+ cli_shell_callbacks.cli_shell_write(str, str_length);
}
#ifdef PHP_WRITE_STDOUT
@@ -376,7 +377,7 @@ static void sapi_cli_register_variables(zval *track_vars_array) /* {{{ */
}
/* }}} */
-static void sapi_cli_log_message(char *message) /* {{{ */
+static void sapi_cli_log_message(char *message, int syslog_type_int) /* {{{ */
{
fprintf(stderr, "%s\n", message);
}
@@ -487,7 +488,7 @@ static const zend_function_entry additional_functions[] = {
ZEND_FE(dl, arginfo_dl)
PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
PHP_FE(cli_get_process_title, arginfo_cli_get_process_title)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* {{{ php_cli_usage
@@ -557,7 +558,6 @@ static php_stream *s_in_process = NULL;
static void cli_register_file_handles(void) /* {{{ */
{
- zval zin, zout, zerr;
php_stream *s_in, *s_out, *s_err;
php_stream_context *sc_in=NULL, *sc_out=NULL, *sc_err=NULL;
zend_constant ic, oc, ec;
@@ -581,23 +581,20 @@ static void cli_register_file_handles(void) /* {{{ */
s_in_process = s_in;
- php_stream_to_zval(s_in, &zin);
- php_stream_to_zval(s_out, &zout);
- php_stream_to_zval(s_err, &zerr);
+ php_stream_to_zval(s_in, &ic.value);
+ php_stream_to_zval(s_out, &oc.value);
+ php_stream_to_zval(s_err, &ec.value);
- ZVAL_COPY_VALUE(&ic.value, &zin);
ic.flags = CONST_CS;
ic.name = zend_string_init("STDIN", sizeof("STDIN")-1, 1);
ic.module_number = 0;
zend_register_constant(&ic);
- ZVAL_COPY_VALUE(&oc.value, &zout);
oc.flags = CONST_CS;
oc.name = zend_string_init("STDOUT", sizeof("STDOUT")-1, 1);
oc.module_number = 0;
zend_register_constant(&oc);
- ZVAL_COPY_VALUE(&ec.value, &zerr);
ec.flags = CONST_CS;
ec.name = zend_string_init("STDERR", sizeof("STDERR")-1, 1);
ec.module_number = 0;
@@ -646,6 +643,17 @@ static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file,
}
/* }}} */
+/*{{{ php_cli_win32_ctrl_handler */
+#if defined(PHP_WIN32) && !defined(PHP_CLI_WIN32_NO_CONSOLE)
+BOOL WINAPI php_cli_win32_ctrl_handler(DWORD sig)
+{
+ (void)php_win32_cp_cli_do_restore(orig_cp);
+
+ return FALSE;
+}
+#endif
+/*}}}*/
+
static int do_cli(int argc, char **argv) /* {{{ */
{
int c;
@@ -689,6 +697,14 @@ static int do_cli(int argc, char **argv) /* {{{ */
#else
"NTS "
#endif
+#ifdef COMPILER
+ COMPILER
+ " "
+#endif
+#ifdef ARCHITECTURE
+ ARCHITECTURE
+ " "
+#endif
#if ZEND_DEBUG
"DEBUG "
#endif
@@ -1163,9 +1179,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
int main(int argc, char *argv[])
#endif
{
-#ifdef PHP_CLI_WIN32_NO_CONSOLE
+#if defined(PHP_WIN32)
+# ifdef PHP_CLI_WIN32_NO_CONSOLE
int argc = __argc;
char **argv = __argv;
+# else
+ int num_args;
+ wchar_t **argv_wide;
+ char **argv_save = argv;
+ BOOL using_wide_argv = 0;
+# endif
#endif
int c;
@@ -1222,9 +1245,7 @@ int main(int argc, char *argv[])
ZEND_TSRMLS_CACHE_UPDATE();
#endif
-#ifdef ZEND_SIGNALS
zend_signal_startup();
-#endif
#ifdef PHP_WIN32
_fmode = _O_BINARY; /*sets default for file streams to binary */
@@ -1332,6 +1353,19 @@ exit_loop:
}
module_started = 1;
+#if defined(PHP_WIN32) && !defined(PHP_CLI_WIN32_NO_CONSOLE)
+ php_win32_cp_cli_setup();
+ orig_cp = (php_win32_cp_get_orig())->id;
+ /* Ignore the delivered argv and argc, read from W API. This place
+ might be too late though, but this is the earliest place ATW
+ we can access the internal charset information from PHP. */
+ argv_wide = CommandLineToArgvW(GetCommandLineW(), &num_args);
+ PHP_WIN32_CP_W_TO_ANY_ARRAY(argv_wide, num_args, argv, argc)
+ using_wide_argv = 1;
+
+ SetConsoleCtrlHandler(php_cli_win32_ctrl_handler, TRUE);
+#endif
+
/* -e option */
if (use_extended_info) {
CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
@@ -1365,6 +1399,15 @@ out:
tsrm_shutdown();
#endif
+#if defined(PHP_WIN32) && !defined(PHP_CLI_WIN32_NO_CONSOLE)
+ (void)php_win32_cp_cli_restore();
+
+ if (using_wide_argv) {
+ PHP_WIN32_CP_FREE_ARRAY(argv, argc);
+ LocalFree(argv_wide);
+ }
+ argv = argv_save;
+#endif
/*
* Do not move this de-initialization. It needs to happen right before
* exiting.
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index de487b66e4..7ae6c6f1a4 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -96,6 +96,7 @@
#include "ext/standard/html.h"
#include "ext/standard/url.h" /* for php_raw_url_decode() */
#include "ext/standard/php_string.h" /* for php_dirname() */
+#include "ext/date/php_date.h" /* for php_format_date() */
#include "php_network.h"
#include "php_http_parser.h"
@@ -339,15 +340,24 @@ static void append_http_status_line(smart_str *buffer, int protocol_version, int
static void append_essential_headers(smart_str* buffer, php_cli_server_client *client, int persistent) /* {{{ */
{
- {
- char *val;
- if (NULL != (val = zend_hash_str_find_ptr(&client->request.headers, "host", sizeof("host")-1))) {
- smart_str_appendl_ex(buffer, "Host", sizeof("Host") - 1, persistent);
- smart_str_appendl_ex(buffer, ": ", sizeof(": ") - 1, persistent);
- smart_str_appends_ex(buffer, val, persistent);
- smart_str_appendl_ex(buffer, "\r\n", 2, persistent);
- }
+ char *val;
+ struct timeval tv = {0};
+
+ if (NULL != (val = zend_hash_str_find_ptr(&client->request.headers, "host", sizeof("host")-1))) {
+ smart_str_appendl_ex(buffer, "Host", sizeof("Host") - 1, persistent);
+ smart_str_appendl_ex(buffer, ": ", sizeof(": ") - 1, persistent);
+ smart_str_appends_ex(buffer, val, persistent);
+ smart_str_appendl_ex(buffer, "\r\n", 2, persistent);
}
+
+ if (!gettimeofday(&tv, NULL)) {
+ zend_string *dt = php_format_date("r", 1, tv.tv_sec, 1);
+ smart_str_appendl_ex(buffer, "Date: ", 6, persistent);
+ smart_str_appends_ex(buffer, dt->val, persistent);
+ smart_str_appendl_ex(buffer, "\r\n", 2, persistent);
+ zend_string_release(dt);
+ }
+
smart_str_appendl_ex(buffer, "Connection: close\r\n", sizeof("Connection: close\r\n") - 1, persistent);
} /* }}} */
@@ -472,7 +482,7 @@ const zend_function_entry server_additional_functions[] = {
PHP_FE(apache_request_headers, arginfo_no_args)
PHP_FE(apache_response_headers, arginfo_no_args)
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */
@@ -679,7 +689,7 @@ static void sapi_cli_server_register_variables(zval *track_vars_array) /* {{{ */
zend_hash_apply_with_arguments(&client->request.headers, (apply_func_args_t)sapi_cli_server_register_entry_cb, 1, track_vars_array);
} /* }}} */
-static void sapi_cli_server_log_message(char *msg) /* {{{ */
+static void sapi_cli_server_log_message(char *msg, int syslog_type_int) /* {{{ */
{
char buf[52];
@@ -992,7 +1002,11 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
if (nbytes_sent < 0) {
*nbytes_sent_total = _nbytes_sent_total;
return php_socket_errno();
+#ifdef PHP_WIN32
} else if (nbytes_sent == chunk->data.heap.len) {
+#else
+ } else if (nbytes_sent == (ssize_t)chunk->data.heap.len) {
+#endif
php_cli_server_chunk_dtor(chunk);
pefree(chunk, 1);
sender->buffer.first = next;
@@ -1015,7 +1029,11 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
if (nbytes_sent < 0) {
*nbytes_sent_total = _nbytes_sent_total;
return php_socket_errno();
+#ifdef PHP_WIN32
} else if (nbytes_sent == chunk->data.immortal.len) {
+#else
+ } else if (nbytes_sent == (ssize_t)chunk->data.immortal.len) {
+#endif
php_cli_server_chunk_dtor(chunk);
pefree(chunk, 1);
sender->buffer.first = next;
@@ -1166,7 +1184,7 @@ static void php_cli_server_logf(const char *format, ...) /* {{{ */
}
if (sapi_module.log_message) {
- sapi_module.log_message(buf);
+ sapi_module.log_message(buf, -1);
}
efree(buf);
@@ -1692,7 +1710,7 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha
}
client->parser.data = client;
nbytes_consumed = php_http_parser_execute(&client->parser, &settings, buf, nbytes_read);
- if (nbytes_consumed != nbytes_read) {
+ if (nbytes_consumed != (size_t)nbytes_read) {
if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
*errstr = estrdup("Unsupported SSL request");
} else {
@@ -1844,7 +1862,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server
if (!chunk) {
goto fail;
}
- snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string, ZSTR_VAL(escaped_request_uri));
+ snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string);
chunk->data.heap.len = strlen(chunk->data.heap.p);
php_cli_server_buffer_append(&client->content_sender.buffer, chunk);
}
@@ -2531,6 +2549,7 @@ int do_cli_server(int argc, char **argv) /* {{{ */
#if defined(HAVE_SIGNAL_H) && defined(SIGINT)
signal(SIGINT, php_cli_server_sigint_handler);
+ zend_signal_init();
#endif
php_cli_server_do_event_loop(&server);
php_cli_server_dtor(&server);
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index 5f8eb3ce0b..59361d0911 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -1539,7 +1539,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
p += to_read - 1;
}
- if (to_read == parser->content_length) {
+ if (to_read == (size_t)parser->content_length) {
state = s_chunk_data_almost_done;
}
diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c
index 15ab0445d8..c7cfd2abda 100644
--- a/sapi/cli/ps_title.c
+++ b/sapi/cli/ps_title.c
@@ -42,6 +42,7 @@
#include "config.w32.h"
#include <windows.h>
#include <process.h>
+#include "win32/codepage.h"
#else
#include "php_config.h"
extern char** environ;
@@ -109,8 +110,6 @@ extern char** environ;
static char windows_error_details[64];
static char ps_buffer[MAX_PATH];
static const size_t ps_buffer_size = MAX_PATH;
-typedef BOOL (WINAPI *MySetConsoleTitle)(LPCTSTR);
-typedef DWORD (WINAPI *MyGetConsoleTitle)(LPTSTR, DWORD);
#elif defined(PS_USE_CLOBBER_ARGV)
static char *ps_buffer; /* will point to argv area */
static size_t ps_buffer_size; /* space determined at run time */
@@ -225,9 +224,9 @@ char** save_ps_args(int argc, char** argv)
{
new_argv[i] = strdup(argv[i]);
if (!new_argv[i]) {
- free(new_argv);
+ free(new_argv);
goto clobber_error;
- }
+ }
}
new_argv[argc] = NULL;
@@ -371,22 +370,13 @@ int set_ps_title(const char* title)
#ifdef PS_USE_WIN32
{
- MySetConsoleTitle set_title = NULL;
- HMODULE hMod = LoadLibrary("kernel32.dll");
+ wchar_t *ps_buffer_w = php_win32_cp_any_to_w(ps_buffer);
- if (!hMod) {
+ if (!ps_buffer_w || !SetConsoleTitleW(ps_buffer_w)) {
return PS_TITLE_WINDOWS_ERROR;
}
- /* NOTE we don't use _UNICODE*/
- set_title = (MySetConsoleTitle)GetProcAddress(hMod, "SetConsoleTitleA");
- if (!set_title) {
- return PS_TITLE_WINDOWS_ERROR;
- }
-
- if (!set_title(ps_buffer)) {
- return PS_TITLE_WINDOWS_ERROR;
- }
+ free(ps_buffer_w);
}
#endif /* PS_USE_WIN32 */
@@ -407,22 +397,23 @@ int get_ps_title(int *displen, const char** string)
#ifdef PS_USE_WIN32
{
- MyGetConsoleTitle get_title = NULL;
- HMODULE hMod = LoadLibrary("kernel32.dll");
+ wchar_t ps_buffer_w[MAX_PATH];
+ char *tmp;
- if (!hMod) {
+ if (!(ps_buffer_cur_len = GetConsoleTitleW(ps_buffer_w, (DWORD)sizeof(ps_buffer_w)))) {
return PS_TITLE_WINDOWS_ERROR;
}
- /* NOTE we don't use _UNICODE*/
- get_title = (MyGetConsoleTitle)GetProcAddress(hMod, "GetConsoleTitleA");
- if (!get_title) {
+ tmp = php_win32_cp_conv_w_to_any(ps_buffer_w, PHP_WIN32_CP_IGNORE_LEN, &ps_buffer_cur_len);
+ if (!tmp) {
return PS_TITLE_WINDOWS_ERROR;
}
- if (!(ps_buffer_cur_len = get_title(ps_buffer, (DWORD)ps_buffer_size))) {
- return PS_TITLE_WINDOWS_ERROR;
- }
+ ps_buffer_cur_len = ps_buffer_cur_len > sizeof(ps_buffer)-1 ? sizeof(ps_buffer)-1 : ps_buffer_cur_len;
+
+ memmove(ps_buffer, tmp, ps_buffer_size);
+ ps_buffer[ps_buffer_cur_len] = '\0';
+ free(tmp);
}
#endif
*displen = (int)ps_buffer_cur_len;
diff --git a/sapi/cli/tests/argv_mb.phpt b/sapi/cli/tests/argv_mb.phpt
new file mode 100644
index 0000000000..e8c47f0972
--- /dev/null
+++ b/sapi/cli/tests/argv_mb.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test basic argv multibyte API integration
+--SKIPIF--
+<?php
+include "skipif.inc";
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die ("skip only for Windows");
+}
+?>
+--FILE--
+<?php
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+
+$argv_fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . "argv_test.php";
+file_put_contents($argv_fl, "<?php var_dump(\$argv); ?>");
+
+var_dump(`$php -n $argv_fl 多字节字符串 マルチバイト文字列 многобайтоваястрока flerbytesträng`);
+
+@unlink($argv_fl);
+
+?>
+==DONE==
+--EXPECTF--
+string(%d) "array(%d) {
+ [0]=>
+ string(%d) "%sargv_test.php"
+ [1]=>
+ string(18) "多字节字符串"
+ [2]=>
+ string(27) "マルチバイト文字列"
+ [3]=>
+ string(38) "многобайтоваястрока"
+ [4]=>
+ string(15) "flerbytesträng"
+}
+"
+==DONE==
diff --git a/sapi/cli/tests/bug43177.phpt b/sapi/cli/tests/bug43177.phpt
index 23af545908..e475fb09b4 100644
--- a/sapi/cli/tests/bug43177.phpt
+++ b/sapi/cli/tests/bug43177.phpt
@@ -61,6 +61,7 @@ HEADER
--EXPECTF--
HTTP/1.1 200 OK
Host: localhost
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
@@ -68,18 +69,21 @@ Content-type: text/html; charset=UTF-8
OK
HTTP/1.0 500 Internal Server Error
Host: localhost
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
HTTP/1.0 500 Internal Server Error
Host: localhost
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
HTTP/1.0 500 Internal Server Error
Host: localhost
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/bug65066_100.phpt b/sapi/cli/tests/bug65066_100.phpt
index 901ba188fd..34381d8e96 100644
--- a/sapi/cli/tests/bug65066_100.phpt
+++ b/sapi/cli/tests/bug65066_100.phpt
@@ -34,6 +34,7 @@ HEADER
--EXPECTF--
HTTP/1.1 100 Continue
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/bug65066_422.phpt b/sapi/cli/tests/bug65066_422.phpt
index 4e5d31c7a7..f25ddfbca6 100644
--- a/sapi/cli/tests/bug65066_422.phpt
+++ b/sapi/cli/tests/bug65066_422.phpt
@@ -34,6 +34,7 @@ HEADER
--EXPECTF--
HTTP/1.1 422 Unknown Status Code
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/bug65066_511.phpt b/sapi/cli/tests/bug65066_511.phpt
index a0b4eae393..27c9f9755a 100644
--- a/sapi/cli/tests/bug65066_511.phpt
+++ b/sapi/cli/tests/bug65066_511.phpt
@@ -34,6 +34,7 @@ HEADER
--EXPECTF--
HTTP/1.1 511 Network Authentication Required
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/bug65633.phpt b/sapi/cli/tests/bug65633.phpt
index 456436b1f7..2e9f2796e8 100644
--- a/sapi/cli/tests/bug65633.phpt
+++ b/sapi/cli/tests/bug65633.phpt
@@ -37,6 +37,7 @@ fclose($fp);
?>
--EXPECTF--
HTTP/1.1 200 OK
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/bug66606_2.phpt b/sapi/cli/tests/bug66606_2.phpt
index 9f539873e1..c47b7736c0 100644
--- a/sapi/cli/tests/bug66606_2.phpt
+++ b/sapi/cli/tests/bug66606_2.phpt
@@ -38,6 +38,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/bug66830.phpt b/sapi/cli/tests/bug66830.phpt
index 58c07e031a..b21b33627e 100644
--- a/sapi/cli/tests/bug66830.phpt
+++ b/sapi/cli/tests/bug66830.phpt
@@ -37,6 +37,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/bug67429.phpt b/sapi/cli/tests/bug67429.phpt
index 856946b29d..2ad4a27f07 100644
--- a/sapi/cli/tests/bug67429.phpt
+++ b/sapi/cli/tests/bug67429.phpt
@@ -38,11 +38,13 @@ HEADER
?>
--EXPECTF--
HTTP/1.1 308 Permanent Redirect
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
HTTP/1.1 426 Upgrade Required
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/bug68745.phpt b/sapi/cli/tests/bug68745.phpt
index 733d7d0900..4cdfe0ae4e 100644
--- a/sapi/cli/tests/bug68745.phpt
+++ b/sapi/cli/tests/bug68745.phpt
@@ -27,6 +27,7 @@ fclose($fp);
?>
--EXPECTF--
HTTP/1.1 200 OK
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/bug71005.phpt b/sapi/cli/tests/bug71005.phpt
index 3a60dcf42f..f02f261fbf 100644
--- a/sapi/cli/tests/bug71005.phpt
+++ b/sapi/cli/tests/bug71005.phpt
@@ -39,6 +39,7 @@ HEADER
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_004.phpt b/sapi/cli/tests/php_cli_server_004.phpt
index 8b913f6596..5e3bbec18f 100644
--- a/sapi/cli/tests/php_cli_server_004.phpt
+++ b/sapi/cli/tests/php_cli_server_004.phpt
@@ -38,6 +38,7 @@ HEADER
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt
index cdd0ae902f..3f9078c8ae 100644
--- a/sapi/cli/tests/php_cli_server_005.phpt
+++ b/sapi/cli/tests/php_cli_server_005.phpt
@@ -50,6 +50,7 @@ HEADER
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_006.phpt b/sapi/cli/tests/php_cli_server_006.phpt
index ad6d6c9598..c68f1e51b0 100644
--- a/sapi/cli/tests/php_cli_server_006.phpt
+++ b/sapi/cli/tests/php_cli_server_006.phpt
@@ -34,6 +34,7 @@ HEADER
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_007.phpt b/sapi/cli/tests/php_cli_server_007.phpt
index 6420ff5a41..b588b9ee2e 100644
--- a/sapi/cli/tests/php_cli_server_007.phpt
+++ b/sapi/cli/tests/php_cli_server_007.phpt
@@ -34,6 +34,7 @@ HEADER
--EXPECTF--
HTTP/1.1 401 Unauthorized
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
WWW-Authenticate: Digest realm="foo",qop="auth",nonce="XXXXX",opaque="acbd18db4cc2f85cedef654fccc4a4d8"
diff --git a/sapi/cli/tests/php_cli_server_008.phpt b/sapi/cli/tests/php_cli_server_008.phpt
index 01f825a746..58b2485db5 100644
--- a/sapi/cli/tests/php_cli_server_008.phpt
+++ b/sapi/cli/tests/php_cli_server_008.phpt
@@ -54,6 +54,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
@@ -61,6 +62,7 @@ Content-type: text/html; charset=UTF-8
string(8) "HTTP/1.1"
HTTP/1.0 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt
index 7f3009b9bd..d63c6abf28 100644
--- a/sapi/cli/tests/php_cli_server_009.phpt
+++ b/sapi/cli/tests/php_cli_server_009.phpt
@@ -78,6 +78,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
@@ -85,6 +86,7 @@ Content-type: text/html; charset=UTF-8
string(8) "/foo/bar"
HTTP/1.0 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_010.phpt b/sapi/cli/tests/php_cli_server_010.phpt
index ce3abeb501..fe8f1a98ca 100644
--- a/sapi/cli/tests/php_cli_server_010.phpt
+++ b/sapi/cli/tests/php_cli_server_010.phpt
@@ -55,6 +55,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
@@ -65,6 +66,7 @@ string(8) "/foo/bar"
string(7) "foo=bar"
HTTP/1.0 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_012.phpt b/sapi/cli/tests/php_cli_server_012.phpt
index 302540f7e6..10b9cdbfe9 100644
--- a/sapi/cli/tests/php_cli_server_012.phpt
+++ b/sapi/cli/tests/php_cli_server_012.phpt
@@ -40,6 +40,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt
index 3ea3ea9cad..23269580fb 100644
--- a/sapi/cli/tests/php_cli_server_013.phpt
+++ b/sapi/cli/tests/php_cli_server_013.phpt
@@ -83,6 +83,7 @@ fclose($fp);
HTTP/1.1 404 Not Found
Host: %s
+Date: %s
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: %d
@@ -91,6 +92,7 @@ Content-Length: %d
</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/</code> was not found on this server.</p></body></html>
HTTP/1.1 404 Not Found
Host: %s
+Date: %s
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: %d
@@ -99,6 +101,7 @@ Content-Length: %d
</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/style.css</code> was not found on this server.</p></body></html>
HTTP/1.1 404 Not Found
Host: %s
+Date: %s
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: %d
diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt
index 4f812e2f63..7c50a5e30a 100644
--- a/sapi/cli/tests/php_cli_server_014.phpt
+++ b/sapi/cli/tests/php_cli_server_014.phpt
@@ -65,6 +65,7 @@ fclose($fp);
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: %s
@@ -72,6 +73,7 @@ Content-type: %s
done
HTTP/1.1 404 Not Found
Host: %s
+Date: %s
Connection: close
Content-Type: %s
Content-Length: %d
diff --git a/sapi/cli/tests/php_cli_server_015.phpt b/sapi/cli/tests/php_cli_server_015.phpt
index af0a3f65a8..663268aea6 100644
--- a/sapi/cli/tests/php_cli_server_015.phpt
+++ b/sapi/cli/tests/php_cli_server_015.phpt
@@ -41,6 +41,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_017.phpt b/sapi/cli/tests/php_cli_server_017.phpt
index 34e7d5e289..28876dc52b 100644
--- a/sapi/cli/tests/php_cli_server_017.phpt
+++ b/sapi/cli/tests/php_cli_server_017.phpt
@@ -37,6 +37,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_018.phpt b/sapi/cli/tests/php_cli_server_018.phpt
index 44e1292934..acfb0f2ce3 100644
--- a/sapi/cli/tests/php_cli_server_018.phpt
+++ b/sapi/cli/tests/php_cli_server_018.phpt
@@ -37,6 +37,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/php_cli_server_019.phpt b/sapi/cli/tests/php_cli_server_019.phpt
index aeb7a9f891..7be87a86c9 100644
--- a/sapi/cli/tests/php_cli_server_019.phpt
+++ b/sapi/cli/tests/php_cli_server_019.phpt
@@ -41,6 +41,7 @@ fclose($fp);
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: %s
Bar-Foo: Foo
diff --git a/sapi/cli/tests/php_cli_server_020.phpt b/sapi/cli/tests/php_cli_server_020.phpt
index 4ed673d380..766c666911 100644
--- a/sapi/cli/tests/php_cli_server_020.phpt
+++ b/sapi/cli/tests/php_cli_server_020.phpt
@@ -33,6 +33,7 @@ HEADER
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt
index bd36ad6cda..21dacb439a 100644
--- a/sapi/cli/tests/upload_2G.phpt
+++ b/sapi/cli/tests/upload_2G.phpt
@@ -81,6 +81,7 @@ Test
HTTP/1.1 200 OK
Host: %s
+Date: %s
Connection: close
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8