Skip to content

Commit 923511d

Browse files
committed
Fixed bug #60723 (error_log error time has changed to UTC ignoring default timezo)
Cherry pick to 5.3
1 parent 2e8ab65 commit 923511d

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw deprecated warning)
3+
--INI--
4+
date.timezone=ASIA/Chongqing
5+
log_errors=On
6+
--FILE--
7+
<?php
8+
$dir = dirname(__FILE__);
9+
$log = $dir . "/tmp.err";
10+
ini_set("error_log", $log);
11+
echo $aa;
12+
error_log("dummy");
13+
readfile($log);
14+
unlink($log);
15+
?>
16+
--EXPECTF--
17+
Notice: Undefined variable: aa in %sbug60723.php on line %d
18+
[%s ASIA/Chongqing] PHP Notice: Undefined variable: aa in %sbug60723.php on line %d
19+
[%s ASIA/Chongqing] dummy

main/main.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,15 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
600600
char *error_time_str;
601601

602602
time(&error_time);
603-
error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC);
603+
#ifdef ZTS
604+
if (!php_during_module_startup()) {
605+
error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC);
606+
} else {
607+
error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC);
608+
}
609+
#else
610+
error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC);
611+
#endif
604612
len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL);
605613
#ifdef PHP_WIN32
606614
php_flock(fd, 2);

0 commit comments

Comments
 (0)