com php-src: Add syslog.filter=raw: NEWS main/main. c main/php_syslog.c main/php_syslog.h php.ini-d evelopment php.ini-production
| From: | Nikita Popov | Date: | Mon, 17 Jun 2019 11:13:25 +0000 |
| Subject: | com php-src: Add syslog.filter=raw: NEWS main/main. c main/php_syslog.c main/php_syslog.h php.ini-d evelopment php.ini-production | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106831@lists.php.net to get a copy of this message | ||
Commit: 9f0515c40c85d9c22cf46f7c42338354c398e4a7
Author: Erik Lundin <erik@coretech.se> Sat, 15 Jun 2019 09:31:16 +0200
Committer: Nikita Popov <nikita.ppv@gmail.com> Mon, 17 Jun 2019 13:13:25 +0200
Parents: 96a6f7f7f572875e0d18de21f5f67429d1ffe099
Branches: PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9f0515c40c85d9c22cf46f7c42338354c398e4a7
Log:
Add syslog.filter=raw
This passes through syslog message unchanged, without splitting
messages at newlines.
Changed paths:
M NEWS
M main/main.c
M main/php_syslog.c
M main/php_syslog.h
M php.ini-development
M php.ini-production
Diff:
diff --git a/NEWS b/NEWS
index 2fe64f4..ecd81b0 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
diff --git a/main/main.c b/main/main.c
index ee422db..98c0a26 100644
--- a/main/main.c
+++ b/main/main.c
@@ -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;
}
diff --git a/main/php_syslog.c b/main/php_syslog.c
index dd16f05..561a63c 100644
--- a/main/php_syslog.c
+++ b/main/php_syslog.c
@@ -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') {
diff --git a/main/php_syslog.h b/main/php_syslog.h
index dee0e5a..401f498 100644
--- a/main/php_syslog.h
+++ b/main/php_syslog.h
@@ -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, ...);
diff --git a/php.ini-development b/php.ini-development
index 320cf17..97e1657 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -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
diff --git a/php.ini-production b/php.ini-production
index 656ae67..a44fe0f 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -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