Skip to content

Commit 305d5e1

Browse files
committed
Merge branch 'PHP-8.1'
2 parents 526af6e + b3e6fae commit 305d5e1

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

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
@@ -71,6 +71,18 @@ PHPAPI void php_syslog_str(int priority, const zend_string* message)
7171
smart_string_free(&sbuf);
7272
}
7373

74+
void php_openlog(const char *ident, int option, int facility)
75+
{
76+
openlog(ident, option, facility);
77+
PG(have_called_openlog) = 1;
78+
}
79+
80+
void php_closelog()
81+
{
82+
closelog();
83+
PG(have_called_openlog) = 0;
84+
}
85+
7486
#ifdef PHP_WIN32
7587
PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
7688
{

main/php_syslog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ BEGIN_EXTERN_C()
3838
PHPAPI void php_syslog_str(int priority, const zend_string* message);
3939
PHPAPI void php_syslog(int, const char *format, ...);
4040
PHPAPI void php_openlog(const char *, int, int);
41+
PHPAPI void php_closelog();
4142
END_EXTERN_C()
4243

4344
#endif

sapi/fpm/fpm/fpm_stdio.c

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

0 commit comments

Comments
 (0)