Download | Plain Text | Line Numbers


diff -Naur a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
--- a/ext/standard/basic_functions_arginfo.h	2020-07-21 10:49:31.000000000 +0200
+++ b/ext/standard/basic_functions_arginfo.h	2020-07-24 23:34:09.954388311 +0200
@@ -2425,12 +2425,14 @@
 ZEND_FUNCTION(sha1_file);
 #if defined(HAVE_SYSLOG_H)
 ZEND_FUNCTION(openlog);
+ZEND_FUNCTION(openlog2);
 #endif
 #if defined(HAVE_SYSLOG_H)
 ZEND_FUNCTION(closelog);
 #endif
 #if defined(HAVE_SYSLOG_H)
 ZEND_FUNCTION(syslog);
+ZEND_FUNCTION(syslog2);
 #endif
 #if defined(HAVE_INET_NTOP)
 ZEND_FUNCTION(inet_ntop);
@@ -3062,12 +3064,14 @@
 	ZEND_FE(sha1_file, arginfo_sha1_file)
 #if defined(HAVE_SYSLOG_H)
 	ZEND_FE(openlog, arginfo_openlog)
+	ZEND_FE(openlog2, arginfo_openlog)
 #endif
 #if defined(HAVE_SYSLOG_H)
 	ZEND_FE(closelog, arginfo_closelog)
 #endif
 #if defined(HAVE_SYSLOG_H)
 	ZEND_FE(syslog, arginfo_syslog)
+	ZEND_FE(syslog2, arginfo_syslog)
 #endif
 #if defined(HAVE_INET_NTOP)
 	ZEND_FE(inet_ntop, arginfo_inet_ntop)
diff -Naur a/ext/standard/mail.c b/ext/standard/mail.c
--- a/ext/standard/mail.c	2020-07-24 12:09:25.650430728 +0200
+++ b/ext/standard/mail.c	2020-07-24 12:35:55.695234580 +0200
@@ -402,7 +402,7 @@
 			php_mail_log_crlf_to_spaces(logline);
 		}
 
-		if (!strcmp(mail_log, "syslog")) {
+		if (!strcmp(mail_log, "syslog2")) {
 			php_mail_log_to_syslog(logline);
 		} else {
 			/* Add date when logging to file */
diff -Naur a/ext/standard/syslog.c b/ext/standard/syslog.c
--- a/ext/standard/syslog.c	2020-07-21 10:49:31.000000000 +0200
+++ b/ext/standard/syslog.c	2020-07-24 12:35:55.696234573 +0200
@@ -134,6 +134,19 @@
  */
 PHP_FUNCTION(openlog)
 {
+	RETURN_TRUE;
+}
+/* }}} */
+
+
+/* {{{ Open connection to system logger */
+/*
+   ** OpenLog("nettopp", $LOG_PID, $LOG_LOCAL1);
+   ** Syslog($LOG_EMERG, "help me!")
+   ** CloseLog();
+ */
+PHP_FUNCTION(openlog2)
+{
 	char *ident;
 	zend_long option, facility;
 	size_t ident_len;
@@ -173,6 +187,13 @@
 /* {{{ Generate a system log message */
 PHP_FUNCTION(syslog)
 {
+	RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ Generate a system log message */
+PHP_FUNCTION(syslog2)
+{
 	zend_long priority;
 	zend_string *message;
 
diff -Naur a/main/main.c b/main/main.c
--- a/main/main.c	2020-07-24 12:24:12.510675800 +0200
+++ b/main/main.c	2020-07-24 12:35:55.697234565 +0200
@@ -795,6 +795,10 @@
 	if (PG(error_log) != NULL) {
 #ifdef HAVE_SYSLOG_H
 		if (!strcmp(PG(error_log), "syslog")) {
+			PG(in_error_log) = 0;
+			return;
+		}
+		else if (!strcmp(PG(error_log), "syslog2")) {
 			php_syslog(syslog_type_int, "%s", log_message);
 			PG(in_error_log) = 0;
 			return;