Skip to content

Commit

Permalink
Fixed bug #60723 (error_log error time has changed to UTC ignoring de…
Browse files Browse the repository at this point in the history
…fault timezo)

Cherry pick to 5.3
  • Loading branch information
laruence committed Sep 24, 2012
1 parent 2e8ab65 commit 923511d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
19 changes: 19 additions & 0 deletions ext/standard/tests/general_functions/bug60723.phpt
Original file line number Diff line number Diff line change
@@ -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--
<?php
$dir = dirname(__FILE__);
$log = $dir . "/tmp.err";
ini_set("error_log", $log);
echo $aa;
error_log("dummy");
readfile($log);
unlink($log);
?>
--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
10 changes: 9 additions & 1 deletion main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 923511d

Please sign in to comment.