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	2023-09-12 13:29:39.000000000 +0200
+++ b/ext/standard/basic_functions_arginfo.h	2023-09-15 10:34:22.567827581 +0200
@@ -2408,12 +2408,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);
@@ -3043,12 +3045,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	2023-09-15 09:50:55.548368055 +0200
+++ b/ext/standard/mail.c	2023-09-15 10:34:22.568827573 +0200
@@ -485,7 +485,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	2023-09-12 13:29:39.000000000 +0200
+++ b/ext/standard/syslog.c	2023-09-15 10:34:22.568827573 +0200
@@ -74,6 +74,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;
@@ -110,6 +123,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	2023-09-15 10:30:47.814505142 +0200
+++ b/main/main.c	2023-09-15 10:34:22.569827565 +0200
@@ -827,6 +827,10 @@
 
 #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;