php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #74860
Patch 1006-multiline-syslog revision 2017-07-05 20:37 UTC by philipp at redfish-solutions dot com

Patch 1006-multiline-syslog for Output Control Bug #74860

Patch version 2017-07-05 20:37 UTC

Return to Bug #74860 | Download this patch
Patch Revisions:

Developer: philipp@redfish-solutions.com

--- a/main/main.c	2017-06-07 02:09:36.000000000 -0600
+++ b/main/main.c	2017-07-05 13:38:37.707402099 -0600
@@ -664,7 +664,13 @@ PHPAPI ZEND_COLD void php_log_err_with_s
 	if (PG(error_log) != NULL) {
 #ifdef HAVE_SYSLOG_H
 		if (!strcmp(PG(error_log), "syslog")) {
-			php_syslog(syslog_type_int, "%s", log_message);
+			char *nl, *msg;
+			for (msg = log_message; msg != NULL; msg = nl + 1) {
+				nl = strchrnul(msg, '\n');
+				php_syslog(syslog_type_int, "%.*s", (nl - msg), msg);
+				if (*nl == '\0')
+					break;
+			}
 			PG(in_error_log) = 0;
 			return;
 		}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 11 05:01:28 2024 UTC