Skip to content

Commit e330f44

Browse files
committed
Fix bug #67764: fpm: syslog.ident does not work
1 parent 651e0cc commit e330f44

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ PHP NEWS
1616
. Fixed bug #78139 (timezone_open accepts invalid timezone string argument).
1717
(Derick)
1818

19+
- FPM:
20+
. Fixed bug #67764 (fpm: syslog.ident don't work). (Jakub Zelenka)
21+
1922
- MBString:
2023
. Fixed bug GH-8685 (pcre not ready at mbstring startup). (Remi)
2124

ext/standard/syslog.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ PHP_MSHUTDOWN_FUNCTION(syslog)
120120
return SUCCESS;
121121
}
122122

123-
void php_openlog(const char *ident, int option, int facility)
124-
{
125-
openlog(ident, option, facility);
126-
PG(have_called_openlog) = 1;
127-
}
128123

129124
/* {{{ Open connection to system logger */
130125
/*
@@ -161,7 +156,7 @@ PHP_FUNCTION(closelog)
161156
{
162157
ZEND_PARSE_PARAMETERS_NONE();
163158

164-
closelog();
159+
php_closelog();
165160
if (BG(syslog_device)) {
166161
free(BG(syslog_device));
167162
BG(syslog_device)=NULL;

main/php_syslog.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@
3232
#define syslog std_syslog
3333
#endif
3434

35+
void php_openlog(const char *ident, int option, int facility)
36+
{
37+
openlog(ident, option, facility);
38+
PG(have_called_openlog) = 1;
39+
}
40+
41+
void php_closelog()
42+
{
43+
closelog();
44+
PG(have_called_openlog) = 0;
45+
}
46+
3547
#ifdef PHP_WIN32
3648
PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
3749
{

main/php_syslog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
BEGIN_EXTERN_C()
3838
PHPAPI void php_syslog(int, const char *format, ...);
3939
PHPAPI void php_openlog(const char *, int, int);
40+
PHPAPI void php_closelog();
4041
END_EXTERN_C()
4142

4243
#endif

sapi/fpm/fpm/fpm_stdio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int fpm_stdio_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
8888
{
8989
#ifdef HAVE_SYSLOG_H
9090
if (fpm_globals.error_log_fd == ZLOG_SYSLOG) {
91-
closelog(); /* ensure to close syslog not to interrupt with PHP syslog code */
91+
php_closelog(); /* ensure to close syslog not to interrupt with PHP syslog code */
9292
} else
9393
#endif
9494

0 commit comments

Comments
 (0)