mirror of
https://github.com/php/php-src.git
synced 2024-12-18 14:30:35 +08:00
Revert "Make BG(syslog_device) per request"
This reverts commit b0d7b126a2
.
This change wasn't quite right: I noticed only now that the
RSHUTDOWN function is #ifdef PHP_WIN32 and I'm not fully convinced
that ifdef can be removed: syslog might also be used by error
logging in FPM for example, in which case we probably shouldn't
be closing the log here.
Generally it's unclear how the openlog() functionality exposed
by PHP is supposed to interact with openlog() uses by SAPIs.
For now I'll just revert this change and let it leak across
requests.
This commit is contained in:
parent
981fdd9f51
commit
453713868f
@ -91,6 +91,7 @@ PHP_MINIT_FUNCTION(syslog)
|
||||
/* AIX doesn't have LOG_PERROR */
|
||||
REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
|
||||
#endif
|
||||
BG(syslog_device)=NULL;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -107,16 +108,16 @@ PHP_RINIT_FUNCTION(syslog)
|
||||
PHP_RSHUTDOWN_FUNCTION(syslog)
|
||||
{
|
||||
closelog();
|
||||
if (BG(syslog_device)) {
|
||||
efree(BG(syslog_device));
|
||||
BG(syslog_device) = NULL;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
PHP_MSHUTDOWN_FUNCTION(syslog)
|
||||
{
|
||||
if (BG(syslog_device)) {
|
||||
free(BG(syslog_device));
|
||||
BG(syslog_device) = NULL;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@ -146,9 +147,9 @@ PHP_FUNCTION(openlog)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (BG(syslog_device)) {
|
||||
efree(BG(syslog_device));
|
||||
free(BG(syslog_device));
|
||||
}
|
||||
BG(syslog_device) = estrndup(ident, ident_len);
|
||||
BG(syslog_device) = zend_strndup(ident, ident_len);
|
||||
if(BG(syslog_device) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@ -165,8 +166,8 @@ PHP_FUNCTION(closelog)
|
||||
|
||||
closelog();
|
||||
if (BG(syslog_device)) {
|
||||
efree(BG(syslog_device));
|
||||
BG(syslog_device) = NULL;
|
||||
free(BG(syslog_device));
|
||||
BG(syslog_device)=NULL;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user