fat                                      Mon, 18 Jul 2011 00:53:13 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=313356

Log:
- don't write directly to stderr, use the internal logger instead (zlog)

Changed paths:
    U   php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c
    U   php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_php.c
    U   php/php-src/trunk/sapi/fpm/fpm/fpm_main.c
    U   php/php-src/trunk/sapi/fpm/fpm/fpm_php.c

Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c        2011-07-18 
00:37:25 UTC (rev 313355)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c        2011-07-18 
00:53:13 UTC (rev 313356)
@@ -620,22 +620,7 @@
 static void sapi_cgi_log_message(char *message TSRMLS_DC)
 {
        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);
        }
 }

@@ -1349,17 +1334,17 @@
        if (!mode) 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;
        }

        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;
        }

        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;
        }

@@ -1367,7 +1352,7 @@
        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);
        }
 }
 /* }}} */

Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_php.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_php.c 2011-07-18 00:37:25 UTC 
(rev 313355)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_php.c 2011-07-18 00:53:13 UTC 
(rev 313356)
@@ -120,13 +120,13 @@

        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);
                }
        }


Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_main.c   2011-07-18 00:37:25 UTC (rev 
313355)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_main.c   2011-07-18 00:53:13 UTC (rev 
313356)
@@ -620,22 +620,7 @@
 static void sapi_cgi_log_message(char *message TSRMLS_DC)
 {
        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);
        }
 }

@@ -1349,17 +1334,17 @@
        if (!mode) 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;
        }

        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;
        }

        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;
        }

@@ -1367,7 +1352,7 @@
        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);
        }
 }
 /* }}} */

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_php.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_php.c    2011-07-18 00:37:25 UTC (rev 
313355)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_php.c    2011-07-18 00:53:13 UTC (rev 
313356)
@@ -120,13 +120,13 @@

        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);
                }
        }


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to