From: Jérôme Loyet Date: Sat, 8 Oct 2011 13:57:31 +0000 (+0000) Subject: - Backported from 5.4 branch (don't write directly to stderr, use the internal logger... X-Git-Tag: php-5.3.9RC1~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7fc36a5210e3066ad9b1ddff2e142e7a971ae1e9;p=php - Backported from 5.4 branch (don't write directly to stderr, use the internal logger instead (zlog)) --- diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 485453e149..b633dc5668 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -656,22 +656,7 @@ static void sapi_cgi_log_message(char *message) TSRMLS_FETCH(); if (CGIG(fcgi_logging)) { - fcgi_request *request; - - request = (fcgi_request*) SG(server_context); - if (request) { - int len = strlen(message); - char *buf = malloc(len+2); - - memcpy(buf, message, len); - memcpy(buf + len, "\n", sizeof("\n")); - fcgi_write(request, FCGI_STDERR, buf, len+1); - free(buf); - } else { - fprintf(stderr, "%s\n", message); - //FIXME zlog(ZLOG_NOTICE, "PHP message: %s", message); - } - /* ignore return code */ + zlog(ZLOG_NOTICE, "PHP message: %s", message); } } @@ -1385,14 +1370,14 @@ static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_ if (!mode || !arg1) return; if (callback_type != ZEND_INI_PARSER_ENTRY) { - fprintf(stderr, "Passing INI directive through FastCGI: only classic entries are allowed\n"); + zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: only classic entries are allowed"); return; } key = Z_STRVAL_P(arg1); if (!key || strlen(key) < 1) { - fprintf(stderr, "Passing INI directive through FastCGI: empty key\n"); + zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty key"); return; } @@ -1401,7 +1386,7 @@ static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_ } if (!value) { - fprintf(stderr, "Passing INI directive through FastCGI: empty value for key '%s'\n", key); + zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty value for key '%s'", key); return; } @@ -1409,7 +1394,7 @@ static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_ kv.value = value; kv.next = NULL; if (fpm_php_apply_defines_ex(&kv, *mode) == -1) { - fprintf(stderr, "Passing INI directive through FastCGI: unable to set '%s'\n", key); + zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: unable to set '%s'", key); } } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index f320f5148e..d541f29446 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -120,13 +120,13 @@ static int fpm_php_apply_defines(struct fpm_worker_pool_s *wp) /* {{{ */ for (kv = wp->config->php_values; kv; kv = kv->next) { if (fpm_php_apply_defines_ex(kv, ZEND_INI_USER) == -1) { - fprintf(stderr, "Unable to set php_value '%s'", kv->key); + zlog(ZLOG_ERROR, "Unable to set php_value '%s'", kv->key); } } for (kv = wp->config->php_admin_values; kv; kv = kv->next) { if (fpm_php_apply_defines_ex(kv, ZEND_INI_SYSTEM) == -1) { - fprintf(stderr, "Unable to set php_admin_value '%s'", kv->key); + zlog(ZLOG_ERROR, "Unable to set php_admin_value '%s'", kv->key); } }