From 923511d364ad84500bb097aca15385129ce6e336 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 23 Sep 2012 22:59:31 +0800 Subject: [PATCH] Fixed bug #60723 (error_log error time has changed to UTC ignoring default timezo) Cherry pick to 5.3 --- .../tests/general_functions/bug60723.phpt | 19 +++++++++++++++++++ main/main.c | 10 +++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 ext/standard/tests/general_functions/bug60723.phpt diff --git a/ext/standard/tests/general_functions/bug60723.phpt b/ext/standard/tests/general_functions/bug60723.phpt new file mode 100644 index 00000000000..cd73c8c0c9e --- /dev/null +++ b/ext/standard/tests/general_functions/bug60723.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw deprecated warning) +--INI-- +date.timezone=ASIA/Chongqing +log_errors=On +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: aa in %sbug60723.php on line %d +[%s ASIA/Chongqing] PHP Notice: Undefined variable: aa in %sbug60723.php on line %d +[%s ASIA/Chongqing] dummy diff --git a/main/main.c b/main/main.c index 6506e10af61..631a6a9fea6 100644 --- a/main/main.c +++ b/main/main.c @@ -600,7 +600,15 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) char *error_time_str; time(&error_time); - error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC); +#ifdef ZTS + if (!php_during_module_startup()) { + error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC); + } else { + error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC); + } +#else + error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC); +#endif len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL); #ifdef PHP_WIN32 php_flock(fd, 2);