Download | Plain Text | Line Numbers


diff -Naur a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
--- a/ext/standard/basic_functions.c	2018-07-31 16:33:11.000000000 +0200
+++ b/ext/standard/basic_functions.c	2018-08-03 19:31:24.129636109 +0200
@@ -2508,6 +2508,12 @@
 	ZEND_ARG_INFO(0, facility)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO(arginfo_openlog2, 0)
+	ZEND_ARG_INFO(0, ident)
+	ZEND_ARG_INFO(0, option)
+	ZEND_ARG_INFO(0, facility)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO(arginfo_closelog, 0)
 ZEND_END_ARG_INFO()
 
@@ -2515,6 +2521,11 @@
 	ZEND_ARG_INFO(0, priority)
 	ZEND_ARG_INFO(0, message)
 ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_syslog2, 0)
+	ZEND_ARG_INFO(0, priority)
+	ZEND_ARG_INFO(0, message)
+ZEND_END_ARG_INFO()
 #endif
 /* }}} */
 /* {{{ type.c */
@@ -3301,7 +3312,9 @@
 	/* functions from syslog.c */
 #ifdef HAVE_SYSLOG_H
 	PHP_FE(openlog,															arginfo_openlog)
+	PHP_FE(openlog2,														arginfo_openlog2)
 	PHP_FE(syslog,															arginfo_syslog)
+	PHP_FE(syslog2,															arginfo_syslog2)
 	PHP_FE(closelog,														arginfo_closelog)
 #endif
 
diff -Naur a/ext/standard/mail.c b/ext/standard/mail.c
--- a/ext/standard/mail.c	2018-07-31 16:33:11.000000000 +0200
+++ b/ext/standard/mail.c	2018-08-03 19:31:24.130636098 +0200
@@ -495,7 +495,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/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
--- a/ext/standard/php_ext_syslog.h	2018-07-31 16:33:11.000000000 +0200
+++ b/ext/standard/php_ext_syslog.h	2018-08-03 19:31:24.130636098 +0200
@@ -31,7 +31,9 @@
 PHP_MSHUTDOWN_FUNCTION(syslog);
 
 PHP_FUNCTION(openlog);
+PHP_FUNCTION(openlog2);
 PHP_FUNCTION(syslog);
+PHP_FUNCTION(syslog2);
 PHP_FUNCTION(closelog);
 
 #endif
diff -Naur a/ext/standard/syslog.c b/ext/standard/syslog.c
--- a/ext/standard/syslog.c	2018-07-31 16:33:09.000000000 +0200
+++ b/ext/standard/syslog.c	2018-08-03 19:31:24.130636098 +0200
@@ -138,6 +138,20 @@
  */
 PHP_FUNCTION(openlog)
 {
+	RETURN_TRUE;
+}
+/* }}} */
+
+
+/* {{{ proto bool openlog2(string ident, int option, int facility)
+   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;
@@ -181,6 +195,14 @@
    Generate a system log message */
 PHP_FUNCTION(syslog)
 {
+	RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto bool syslog2(int priority, string message)
+   Generate a system log message */
+PHP_FUNCTION(syslog2)
+{
 	zend_long priority;
 	char *message;
 	size_t message_len;
diff -Naur a/main/main.c b/main/main.c
--- a/main/main.c	2018-07-31 16:33:06.000000000 +0200
+++ b/main/main.c	2018-08-03 19:31:24.131636088 +0200
@@ -845,6 +845,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;