fat Thu, 11 Nov 2010 22:48:46 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=305282
Log: - Fixed bug #52693 (configuration file errors are not logged to stderr) Bug: http://bugs.php.net/52693 (Analyzed) configuration file errors are not logged to stderr Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_unix.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.h U php/php-src/trunk/sapi/fpm/fpm/fpm.c U php/php-src/trunk/sapi/fpm/fpm/fpm_stdio.c U php/php-src/trunk/sapi/fpm/fpm/fpm_unix.c U php/php-src/trunk/sapi/fpm/fpm/zlog.c U php/php-src/trunk/sapi/fpm/fpm/zlog.h Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/branches/PHP_5_3/NEWS 2010-11-11 22:48:46 UTC (rev 305282) @@ -58,6 +58,7 @@ - Fixed the filter extension accepting IPv4 octets with a leading 0 as that belongs to the unsupported "dotted octal" representation. (Gustavo) +- Fixed bug #52693 (configuration file errors are not logged to stderr). (fat) - Fixed bug #53279 (SplFileObject doesn't initialise default CSV escape character). (Adam) - Fixed bug #53273 (mb_strcut() returns garbage with the excessive length Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c 2010-11-11 22:48:46 UTC (rev 305282) @@ -47,6 +47,7 @@ return -1; } + fpm_stdio_init_final(); zlog(ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid); return 0; Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c 2010-11-11 22:48:46 UTC (rev 305282) @@ -41,7 +41,6 @@ int fpm_stdio_init_final() /* {{{ */ { - zlog_set_level(fpm_globals.log_level); if (fpm_global_config.daemonize) { if (fpm_globals.error_log_fd != STDERR_FILENO) { /* there might be messages to stderr from libevent, we need to log them all */ @@ -50,8 +49,8 @@ return -1; } } - zlog_set_fd(fpm_globals.error_log_fd); } + zlog_set_launched(); return 0; } /* }}} */ @@ -251,6 +250,9 @@ fd = fpm_globals.error_log_fd; /* for FD_CLOSEXEC to work */ } else { fpm_globals.error_log_fd = fd; + if (fpm_global_config.daemonize) { + zlog_set_fd(fpm_globals.error_log_fd); + } } fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); return 0; Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_unix.c =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_unix.c 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_unix.c 2010-11-11 22:48:46 UTC (rev 305282) @@ -246,7 +246,7 @@ } } - fpm_stdio_init_final(); + zlog_set_level(fpm_globals.log_level); return 0; } /* }}} */ Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.c =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.c 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.c 2010-11-11 22:48:46 UTC (rev 305282) @@ -18,6 +18,7 @@ static int zlog_fd = -1; static int zlog_level = ZLOG_NOTICE; +static int launched = 0; static const char *level_names[] = { [ZLOG_DEBUG] = "DEBUG", @@ -27,6 +28,10 @@ [ZLOG_ALERT] = "ALERT", }; +void zlog_set_launched(void) { + launched = 1; +} + size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len) /* {{{ */ { struct tm t; @@ -110,6 +115,9 @@ buf[len++] = '\n'; write(zlog_fd > -1 ? zlog_fd : STDERR_FILENO, buf, len); + if (zlog_fd != STDERR_FILENO && zlog_fd > -1 && !launched && (flags & ZLOG_LEVEL_MASK) >= ZLOG_WARNING) { + write(STDERR_FILENO, buf, len); + } } /* }}} */ Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.h =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.h 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/zlog.h 2010-11-11 22:48:46 UTC (rev 305282) @@ -11,6 +11,7 @@ int zlog_set_fd(int new_fd); int zlog_set_level(int new_value); +void zlog_set_launched(void); size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len); Modified: php/php-src/trunk/sapi/fpm/fpm/fpm.c =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/fpm.c 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/trunk/sapi/fpm/fpm/fpm.c 2010-11-11 22:48:46 UTC (rev 305282) @@ -47,6 +47,7 @@ return -1; } + fpm_stdio_init_final(); zlog(ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid); return 0; Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_stdio.c =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/fpm_stdio.c 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_stdio.c 2010-11-11 22:48:46 UTC (rev 305282) @@ -41,7 +41,6 @@ int fpm_stdio_init_final() /* {{{ */ { - zlog_set_level(fpm_globals.log_level); if (fpm_global_config.daemonize) { if (fpm_globals.error_log_fd != STDERR_FILENO) { /* there might be messages to stderr from libevent, we need to log them all */ @@ -50,8 +49,8 @@ return -1; } } - zlog_set_fd(fpm_globals.error_log_fd); } + zlog_set_launched(); return 0; } /* }}} */ @@ -251,6 +250,9 @@ fd = fpm_globals.error_log_fd; /* for FD_CLOSEXEC to work */ } else { fpm_globals.error_log_fd = fd; + if (fpm_global_config.daemonize) { + zlog_set_fd(fpm_globals.error_log_fd); + } } fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); return 0; Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_unix.c =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/fpm_unix.c 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_unix.c 2010-11-11 22:48:46 UTC (rev 305282) @@ -246,7 +246,7 @@ } } - fpm_stdio_init_final(); + zlog_set_level(fpm_globals.log_level); return 0; } /* }}} */ Modified: php/php-src/trunk/sapi/fpm/fpm/zlog.c =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/zlog.c 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/trunk/sapi/fpm/fpm/zlog.c 2010-11-11 22:48:46 UTC (rev 305282) @@ -18,6 +18,7 @@ static int zlog_fd = -1; static int zlog_level = ZLOG_NOTICE; +static int launched = 0; static const char *level_names[] = { [ZLOG_DEBUG] = "DEBUG", @@ -27,6 +28,10 @@ [ZLOG_ALERT] = "ALERT", }; +void zlog_set_launched(void) { + launched = 1; +} + size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len) /* {{{ */ { struct tm t; @@ -110,6 +115,9 @@ buf[len++] = '\n'; write(zlog_fd > -1 ? zlog_fd : STDERR_FILENO, buf, len); + if (zlog_fd != STDERR_FILENO && zlog_fd > -1 && !launched && (flags & ZLOG_LEVEL_MASK) >= ZLOG_WARNING) { + write(STDERR_FILENO, buf, len); + } } /* }}} */ Modified: php/php-src/trunk/sapi/fpm/fpm/zlog.h =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/zlog.h 2010-11-11 21:38:18 UTC (rev 305281) +++ php/php-src/trunk/sapi/fpm/fpm/zlog.h 2010-11-11 22:48:46 UTC (rev 305282) @@ -11,6 +11,7 @@ int zlog_set_fd(int new_fd); int zlog_set_level(int new_value); +void zlog_set_launched(void); size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
