Download | Plain Text | No Line Numbers


  1. diff -Naur a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
  2. --- a/ext/standard/basic_functions.c 2018-07-31 16:33:11.000000000 +0200
  3. +++ b/ext/standard/basic_functions.c 2018-08-03 19:31:24.129636109 +0200
  4. @@ -2508,6 +2508,12 @@
  5. ZEND_ARG_INFO(0, facility)
  6. ZEND_END_ARG_INFO()
  7.  
  8. +ZEND_BEGIN_ARG_INFO(arginfo_openlog2, 0)
  9. + ZEND_ARG_INFO(0, ident)
  10. + ZEND_ARG_INFO(0, option)
  11. + ZEND_ARG_INFO(0, facility)
  12. +ZEND_END_ARG_INFO()
  13. +
  14. ZEND_BEGIN_ARG_INFO(arginfo_closelog, 0)
  15. ZEND_END_ARG_INFO()
  16.  
  17. @@ -2515,6 +2521,11 @@
  18. ZEND_ARG_INFO(0, priority)
  19. ZEND_ARG_INFO(0, message)
  20. ZEND_END_ARG_INFO()
  21. +
  22. +ZEND_BEGIN_ARG_INFO(arginfo_syslog2, 0)
  23. + ZEND_ARG_INFO(0, priority)
  24. + ZEND_ARG_INFO(0, message)
  25. +ZEND_END_ARG_INFO()
  26. #endif
  27. /* }}} */
  28. /* {{{ type.c */
  29. @@ -3301,7 +3312,9 @@
  30. /* functions from syslog.c */
  31. #ifdef HAVE_SYSLOG_H
  32. PHP_FE(openlog, arginfo_openlog)
  33. + PHP_FE(openlog2, arginfo_openlog2)
  34. PHP_FE(syslog, arginfo_syslog)
  35. + PHP_FE(syslog2, arginfo_syslog2)
  36. PHP_FE(closelog, arginfo_closelog)
  37. #endif
  38.  
  39. diff -Naur a/ext/standard/mail.c b/ext/standard/mail.c
  40. --- a/ext/standard/mail.c 2018-07-31 16:33:11.000000000 +0200
  41. +++ b/ext/standard/mail.c 2018-08-03 19:31:24.130636098 +0200
  42. @@ -495,7 +495,7 @@
  43. php_mail_log_crlf_to_spaces(logline);
  44. }
  45.  
  46. - if (!strcmp(mail_log, "syslog")) {
  47. + if (!strcmp(mail_log, "syslog2")) {
  48. php_mail_log_to_syslog(logline);
  49. } else {
  50. /* Add date when logging to file */
  51. diff -Naur a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
  52. --- a/ext/standard/php_ext_syslog.h 2018-07-31 16:33:11.000000000 +0200
  53. +++ b/ext/standard/php_ext_syslog.h 2018-08-03 19:31:24.130636098 +0200
  54. @@ -31,7 +31,9 @@
  55. PHP_MSHUTDOWN_FUNCTION(syslog);
  56.  
  57. PHP_FUNCTION(openlog);
  58. +PHP_FUNCTION(openlog2);
  59. PHP_FUNCTION(syslog);
  60. +PHP_FUNCTION(syslog2);
  61. PHP_FUNCTION(closelog);
  62.  
  63. #endif
  64. diff -Naur a/ext/standard/syslog.c b/ext/standard/syslog.c
  65. --- a/ext/standard/syslog.c 2018-07-31 16:33:09.000000000 +0200
  66. +++ b/ext/standard/syslog.c 2018-08-03 19:31:24.130636098 +0200
  67. @@ -138,6 +138,20 @@
  68. */
  69. PHP_FUNCTION(openlog)
  70. {
  71. + RETURN_TRUE;
  72. +}
  73. +/* }}} */
  74. +
  75. +
  76. +/* {{{ proto bool openlog2(string ident, int option, int facility)
  77. + Open connection to system logger */
  78. +/*
  79. + ** OpenLog("nettopp", $LOG_PID, $LOG_LOCAL1);
  80. + ** Syslog($LOG_EMERG, "help me!")
  81. + ** CloseLog();
  82. + */
  83. +PHP_FUNCTION(openlog2)
  84. +{
  85. char *ident;
  86. zend_long option, facility;
  87. size_t ident_len;
  88. @@ -181,6 +195,14 @@
  89. Generate a system log message */
  90. PHP_FUNCTION(syslog)
  91. {
  92. + RETURN_TRUE;
  93. +}
  94. +/* }}} */
  95. +
  96. +/* {{{ proto bool syslog2(int priority, string message)
  97. + Generate a system log message */
  98. +PHP_FUNCTION(syslog2)
  99. +{
  100. zend_long priority;
  101. char *message;
  102. size_t message_len;
  103. diff -Naur a/main/main.c b/main/main.c
  104. --- a/main/main.c 2018-07-31 16:33:06.000000000 +0200
  105. +++ b/main/main.c 2018-08-03 19:31:24.131636088 +0200
  106. @@ -845,6 +845,10 @@
  107. if (PG(error_log) != NULL) {
  108. #ifdef HAVE_SYSLOG_H
  109. if (!strcmp(PG(error_log), "syslog")) {
  110. + PG(in_error_log) = 0;
  111. + return;
  112. + }
  113. + else if (!strcmp(PG(error_log), "syslog2")) {
  114. php_syslog(syslog_type_int, "%s", log_message);
  115. PG(in_error_log) = 0;
  116. return;
  117.