summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/main.c4
-rw-r--r--main/php_syslog.c7
-rw-r--r--main/php_syslog.h1
-rw-r--r--php.ini-development1
-rw-r--r--php.ini-production1
5 files changed, 14 insertions, 0 deletions
diff --git a/main/main.c b/main/main.c
index a6c51e79f0..f87d07a192 100644
--- a/main/main.c
+++ b/main/main.c
@@ -344,6 +344,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 bac29a9042..987ef9cc0c 100644
--- a/main/php_syslog.c
+++ b/main/php_syslog.c
@@ -76,6 +76,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 b5df765ddd..2c499269a4 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 f9957045a4..c78921980e 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -588,6 +588,7 @@ report_memleaks = 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 3bc67c6a5e..e3f061e3fb 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -595,6 +595,7 @@ report_memleaks = 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