Skip to content

Commit 1b63528

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
2 parents d584f92 + 9f0515c commit 1b63528

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

main/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ static PHP_INI_MH(OnSetLogFilter)
344344
PG(syslog_filter) = PHP_SYSLOG_FILTER_ASCII;
345345
return SUCCESS;
346346
}
347+
if (!strcmp(filter, "raw")) {
348+
PG(syslog_filter) = PHP_SYSLOG_FILTER_RAW;
349+
return SUCCESS;
350+
}
347351

348352
return FAILURE;
349353
}

main/php_syslog.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
7676
smart_string_0(&fbuf);
7777
va_end(args);
7878

79+
if (PG(syslog_filter) == PHP_SYSLOG_FILTER_RAW) {
80+
/* Just send it directly to the syslog */
81+
syslog(priority, "%.*s", (int)fbuf.len, fbuf.c);
82+
smart_string_free(&fbuf);
83+
return;
84+
}
85+
7986
for (ptr = fbuf.c; ; ++ptr) {
8087
c = *ptr;
8188
if (c == '\0') {

main/php_syslog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define PHP_SYSLOG_FILTER_ALL 0
3535
#define PHP_SYSLOG_FILTER_NO_CTRL 1
3636
#define PHP_SYSLOG_FILTER_ASCII 2
37+
#define PHP_SYSLOG_FILTER_RAW 3
3738

3839
BEGIN_EXTERN_C()
3940
PHPAPI void php_syslog(int, const char *format, ...);

php.ini-development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ report_memleaks = On
588588
; ascii (all printable ASCII characters and NL)
589589
; no-ctrl (all characters except control characters)
590590
; all (all characters)
591+
; raw (like "all", but messages are not split at newlines)
591592
; http://php.net/syslog.filter
592593
;syslog.filter = ascii
593594

php.ini-production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ report_memleaks = On
595595
; ascii (all printable ASCII characters and NL)
596596
; no-ctrl (all characters except control characters)
597597
; all (all characters)
598+
; raw (like "all", but messages are not split at newlines)
598599
; http://php.net/syslog.filter
599600
;syslog.filter = ascii
600601

0 commit comments

Comments
 (0)