return env;
}
/* Check config setting for default timezone */
- if (DATEG(default_timezone) && (strlen(DATEG(default_timezone)) > 0) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
+ if (!DATEG(default_timezone)) {
+ /* Special case: ext/date wasn't initialized yet */
+ zval ztz;
+
+ if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz) &&
+ Z_TYPE(ztz) == IS_STRING &&
+ Z_STRLEN(ztz) > 0 &&
+ timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) {
+ return Z_STRVAL(ztz);
+ }
+ } else if (*DATEG(default_timezone) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
return DATEG(default_timezone);
}
#if HAVE_TM_ZONE
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
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);
efree(tmp);
efree(error_time_str);
close(fd);
+ PG(in_error_log) = 0;
return;
}
}
if (sapi_module.log_message) {
sapi_module.log_message(log_message);
}
+ PG(in_error_log) = 0;
}
/* }}} */
#endif
zend_try {
+ PG(in_error_log) = 0;
PG(during_request_startup) = 1;
php_output_activate(TSRMLS_C);