Skip to content

Commit b3e6fae

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
2 parents 5869e8a + e330f44 commit b3e6fae

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ PHP NEWS
2929
- GD:
3030
. Fixed imagecreatefromavif() memory leak. (cmb)
3131

32+
- FPM:
33+
. Fixed bug #67764 (fpm: syslog.ident don't work). (Jakub Zelenka)
34+
3235
- MBString:
3336
. mb_detect_encoding recognizes all letters in Czech alphabet (alexdowad)
3437
. mb_detect_encoding recognizes all letters in Hungarian alphabet (alexdowad)

ext/standard/syslog.c

+1-6
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

+12
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

+1
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

+1-1
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)