diff options
| author | Dmitry Stogov <dmitry@php.net> | 2009-10-05 13:56:49 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2009-10-05 13:56:49 +0000 |
| commit | ffb07732f7418d78d74454a7850d358f95753a23 (patch) | |
| tree | 42c46d1f3eeb7beae24ca44530d2e7cceaf2a85b /main | |
| parent | 8172c388b095e1579bf53098ae57ccab02a92319 (diff) | |
| download | php-git-ffb07732f7418d78d74454a7850d358f95753a23.tar.gz | |
Fixed bug #49627 (error_log to specified file does not log time according to date.timezone)
Diffstat (limited to 'main')
| -rw-r--r-- | main/main.c | 12 | ||||
| -rw-r--r-- | main/php_globals.h | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/main/main.c b/main/main.c index 8d394162b3..8e067f6257 100644 --- a/main/main.c +++ b/main/main.c @@ -556,11 +556,18 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) int fd = -1; time_t error_time; + if (PG(in_error_log)) { + /* prevent recursive invocation */ + return; + } + PG(in_error_log) = 1; + /* Try to use the specified logging location. */ if (PG(error_log) != NULL) { #ifdef HAVE_SYSLOG_H if (!strcmp(PG(error_log), "syslog")) { php_syslog(LOG_NOTICE, "%.500s", log_message); + PG(in_error_log) = 0; return; } #endif @@ -571,7 +578,7 @@ 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", 11, error_time, php_during_module_startup() TSRMLS_CC); + error_time_str = php_format_date("d-M-Y H:i:s", 11, error_time, 1 TSRMLS_CC); len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL); #ifdef PHP_WIN32 php_flock(fd, 2); @@ -580,6 +587,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) efree(tmp); efree(error_time_str); close(fd); + PG(in_error_log) = 0; return; } } @@ -589,6 +597,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) if (sapi_module.log_message) { sapi_module.log_message(log_message); } + PG(in_error_log) = 0; } /* }}} */ @@ -1352,6 +1361,7 @@ int php_request_startup(TSRMLS_D) #endif zend_try { + PG(in_error_log) = 0; PG(during_request_startup) = 1; php_output_activate(TSRMLS_C); diff --git a/main/php_globals.h b/main/php_globals.h index 64b2f734a9..646c761648 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -168,6 +168,8 @@ struct _php_core_globals { zend_bool mail_x_header; char *mail_log; + + zend_bool in_error_log; }; |
