diff --git a/NEWS b/NEWS index e64e02cbf42..d5fb8b05860 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,9 @@ PHP NEWS - GD: . Fixed imagecreatefromavif() memory leak. (cmb) +- FPM: + . Fixed bug #67764 (fpm: syslog.ident don't work). (Jakub Zelenka) + - MBString: . mb_detect_encoding recognizes all letters in Czech alphabet (alexdowad) . mb_detect_encoding recognizes all letters in Hungarian alphabet (alexdowad) diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index d2cfcab9ded..70fa8e241ab 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -120,11 +120,6 @@ PHP_MSHUTDOWN_FUNCTION(syslog) return SUCCESS; } -void php_openlog(const char *ident, int option, int facility) -{ - openlog(ident, option, facility); - PG(have_called_openlog) = 1; -} /* {{{ Open connection to system logger */ /* @@ -161,7 +156,7 @@ PHP_FUNCTION(closelog) { ZEND_PARSE_PARAMETERS_NONE(); - closelog(); + php_closelog(); if (BG(syslog_device)) { free(BG(syslog_device)); BG(syslog_device)=NULL; diff --git a/main/php_syslog.c b/main/php_syslog.c index 54d871c6aca..b90719609ea 100644 --- a/main/php_syslog.c +++ b/main/php_syslog.c @@ -71,6 +71,18 @@ PHPAPI void php_syslog_str(int priority, const zend_string* message) smart_string_free(&sbuf); } +void php_openlog(const char *ident, int option, int facility) +{ + openlog(ident, option, facility); + PG(have_called_openlog) = 1; +} + +void php_closelog() +{ + closelog(); + PG(have_called_openlog) = 0; +} + #ifdef PHP_WIN32 PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */ { diff --git a/main/php_syslog.h b/main/php_syslog.h index 2005a03ef9e..e39de02bd05 100644 --- a/main/php_syslog.h +++ b/main/php_syslog.h @@ -38,6 +38,7 @@ BEGIN_EXTERN_C() PHPAPI void php_syslog_str(int priority, const zend_string* message); PHPAPI void php_syslog(int, const char *format, ...); PHPAPI void php_openlog(const char *, int, int); +PHPAPI void php_closelog(); END_EXTERN_C() #endif diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c index 81ec632fb25..e920923b009 100644 --- a/sapi/fpm/fpm/fpm_stdio.c +++ b/sapi/fpm/fpm/fpm_stdio.c @@ -89,7 +89,7 @@ int fpm_stdio_init_child(struct fpm_worker_pool_s *wp) /* {{{ */ { #ifdef HAVE_SYSLOG_H if (fpm_globals.error_log_fd == ZLOG_SYSLOG) { - closelog(); /* ensure to close syslog not to interrupt with PHP syslog code */ + php_closelog(); /* ensure to close syslog not to interrupt with PHP syslog code */ } else #endif