Skip to content

Commit 395d77c

Browse files
committed
Fixed bug #60723 (error_log error time has changed to UTC ignoring default timezo)
1 parent c8687ee commit 395d77c

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ PHP NEWS
2424
situation). (Dmitry)
2525
. Fixed bug #60909 (custom error handler throwing Exception + fatal error
2626
= no shutdown function). (Dmitry)
27+
. Fixed bug #60723 (error_log error time has changed to UTC ignoring default
28+
timezo). (Laruence)
2729

2830
- DOM:
2931
. Fixed bug #63015 (Incorrect arginfo for DOMErrorHandler). (Rob)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
readfile($log);
13+
unlink($log);
14+
?>
15+
--EXPECTF--
16+
Notice: Undefined variable: aa in %sbug60723.php on line %d
17+
[%s ASIA/Chongqing] PHP Notice: Undefined variable: aa in %sbug60723.php on line %d

main/main.c

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

630630
time(&error_time);
631-
error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC);
631+
#ifdef ZTS
632+
if (!php_during_module_startup()) {
633+
error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC);
634+
} else {
635+
error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC);
636+
}
637+
#else
638+
error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC);
639+
#endif
632640
len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL);
633641
#ifdef PHP_WIN32
634642
php_flock(fd, 2);

0 commit comments

Comments
 (0)