1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Add syslog.filter=raw

This passes through syslog message unchanged, without splitting
messages at newlines.
This commit is contained in:
Erik Lundin
2019-06-15 09:31:16 +02:00
committed by Nikita Popov
parent 96a6f7f7f5
commit 9f0515c40c
6 changed files with 17 additions and 0 deletions

3
NEWS
View File

@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.8
- Core:
. Added syslog.filter=raw option. (Erik Lundin)
- Opcache:
. Fixed bug #78106 (Path resolution fails if opcache disabled during request).
(Nikita)

View File

@@ -346,6 +346,10 @@ static PHP_INI_MH(OnSetLogFilter)
PG(syslog_filter) = PHP_SYSLOG_FILTER_ASCII;
return SUCCESS;
}
if (!strcmp(filter, "raw")) {
PG(syslog_filter) = PHP_SYSLOG_FILTER_RAW;
return SUCCESS;
}
return FAILURE;
}

View File

@@ -77,6 +77,13 @@ PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
smart_string_0(&fbuf);
va_end(args);
if (PG(syslog_filter) == PHP_SYSLOG_FILTER_RAW) {
/* Just send it directly to the syslog */
syslog(priority, "%.*s", (int)fbuf.len, fbuf.c);
smart_string_free(&fbuf);
return;
}
for (ptr = fbuf.c; ; ++ptr) {
c = *ptr;
if (c == '\0') {

View File

@@ -34,6 +34,7 @@
#define PHP_SYSLOG_FILTER_ALL 0
#define PHP_SYSLOG_FILTER_NO_CTRL 1
#define PHP_SYSLOG_FILTER_ASCII 2
#define PHP_SYSLOG_FILTER_RAW 3
BEGIN_EXTERN_C()
PHPAPI void php_syslog(int, const char *format, ...);

View File

@@ -596,6 +596,7 @@ html_errors = On
; ascii (all printable ASCII characters and NL)
; no-ctrl (all characters except control characters)
; all (all characters)
; raw (like "all", but messages are not split at newlines)
; http://php.net/syslog.filter
;syslog.filter = ascii

View File

@@ -603,6 +603,7 @@ html_errors = On
; ascii (all printable ASCII characters and NL)
; no-ctrl (all characters except control characters)
; all (all characters)
; raw (like "all", but messages are not split at newlines)
; http://php.net/syslog.filter
;syslog.filter = ascii