From f46ef1b121e421eb4b773dd9a3a951bb021b66ff Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Tue, 21 Jul 2020 20:27:37 +0300 Subject: [PATCH] PHP: fixed incorrect time in interpreter error log messages. Previously, the log message callback used a generic log function, that relied on the process time cache. Since there were no time update calls in the application processes, all log lines were printed with the same time, usually correlated with the process start. Now, a non-cached logging function from libunit is used. --- src/nxt_php_sapi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c index 7ae8484d..ab888f57 100644 --- a/src/nxt_php_sapi.c +++ b/src/nxt_php_sapi.c @@ -251,9 +251,9 @@ NXT_EXPORT nxt_app_module_t nxt_app_module = { static nxt_php_target_t *nxt_php_targets; static nxt_int_t nxt_php_last_target = -1; -static nxt_task_t *nxt_php_task; +static nxt_unit_ctx_t *nxt_php_unit_ctx; #if defined(ZTS) && PHP_VERSION_ID < 70400 -static void ***tsrm_ls; +static void ***tsrm_ls; #endif @@ -277,8 +277,6 @@ nxt_php_start(nxt_task_t *task, nxt_process_data_t *data) static nxt_str_t user_str = nxt_string("user"); static nxt_str_t admin_str = nxt_string("admin"); - nxt_php_task = task; - conf = data->app; c = &conf->u.php; @@ -405,6 +403,8 @@ nxt_php_start(nxt_task_t *task, nxt_process_data_t *data) return NXT_ERROR; } + nxt_php_unit_ctx = unit_ctx; + nxt_unit_run(unit_ctx); nxt_unit_done(unit_ctx); @@ -1277,5 +1277,6 @@ static void nxt_php_log_message(char *message TSRMLS_DC) #endif { - nxt_log(nxt_php_task, NXT_LOG_NOTICE, "php message: %s", message); + nxt_unit_log(nxt_php_unit_ctx, NXT_UNIT_LOG_NOTICE, + "php message: %s", message); }