Download | Plain Text | No Line Numbers


  1. diff -Naur php-7.2.0.orig/ext/standard/basic_functions.c php-7.2.0/ext/standard/basic_functions.c
  2. --- php-7.2.0.orig/ext/standard/basic_functions.c 2017-11-12 18:57:06.767056261 +0100
  3. +++ php-7.2.0/ext/standard/basic_functions.c 2017-11-12 18:57:19.331911149 +0100
  4. @@ -2492,6 +2492,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. @@ -2499,6 +2505,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. @@ -3274,7 +3285,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 php-7.2.0.orig/ext/standard/mail.c php-7.2.0/ext/standard/mail.c
  40. --- php-7.2.0.orig/ext/standard/mail.c 2017-11-12 18:57:06.690057150 +0100
  41. +++ php-7.2.0/ext/standard/mail.c 2017-11-12 18:57:19.332911137 +0100
  42. @@ -577,7 +577,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 php-7.2.0.orig/ext/standard/php_ext_syslog.h php-7.2.0/ext/standard/php_ext_syslog.h
  52. --- php-7.2.0.orig/ext/standard/php_ext_syslog.h 2017-11-12 18:57:06.766056272 +0100
  53. +++ php-7.2.0/ext/standard/php_ext_syslog.h 2017-11-12 18:57:19.332911137 +0100
  54. @@ -33,7 +33,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 php-7.2.0.orig/ext/standard/syslog.c php-7.2.0/ext/standard/syslog.c
  65. --- php-7.2.0.orig/ext/standard/syslog.c 2017-11-12 18:57:06.768056249 +0100
  66. +++ php-7.2.0/ext/standard/syslog.c 2017-11-12 18:57:19.332911137 +0100
  67. @@ -134,6 +134,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. @@ -177,6 +191,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 php-7.2.0.orig/main/main.c php-7.2.0/main/main.c
  104. --- php-7.2.0.orig/main/main.c 2017-11-12 18:57:06.663057462 +0100
  105. +++ php-7.2.0/main/main.c 2017-11-12 18:57:19.333911126 +0100
  106. @@ -687,6 +687,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.