1 commit 4d77af8d7d349b7b9e43082deb47c1469f450115
2 Author: Philip Prindeville <philipp@redfish-solutions.com>
3 Date: Fri Aug 18 12:05:44 2017 -0600
5 Backport of fix for Issue #74860
7 diff --git a/configure.in b/configure.in
8 index 9acf42b..559a274 100644
11 @@ -1470,7 +1470,7 @@ PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
12 php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
13 strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
14 network.c php_open_temporary_file.c \
15 - output.c getopt.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
16 + output.c getopt.c php_syslog.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
18 PHP_ADD_SOURCES_X(main, fastcgi.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_FASTCGI_OBJS, no)
20 diff --git a/ext/standard/php_smart_string.h b/ext/standard/php_smart_string.h
21 index adb78c0..8d90688 100644
22 --- a/ext/standard/php_smart_string.h
23 +++ b/ext/standard/php_smart_string.h
25 #define smart_string_sets(dest, src) \
26 smart_string_setl((dest), (src), strlen(src));
28 +#define smart_string_reset(dest) do { \
33 diff --git a/main/php_syslog.c b/main/php_syslog.c
35 index 0000000..43d1f56
37 +++ b/main/php_syslog.c
40 + +----------------------------------------------------------------------+
42 + +----------------------------------------------------------------------+
43 + | Copyright (c) 2017 The PHP Group |
44 + +----------------------------------------------------------------------+
45 + | This source file is subject to version 3.01 of the PHP license, |
46 + | that is bundled with this package in the file LICENSE, and is |
47 + | available through the world-wide-web at the following url: |
48 + | http://www.php.net/license/3_01.txt |
49 + | If you did not receive a copy of the PHP license and are unable to |
50 + | obtain it through the world-wide-web, please send a note to |
51 + | license@php.net so we can mail you a copy immediately. |
52 + +----------------------------------------------------------------------+
53 + | Author: Philip Prindeville <philipp@redfish-solutions.com> |
54 + +----------------------------------------------------------------------+
64 +#include "php_syslog.h"
67 +#include "ext/standard/php_smart_string.h"
70 + * The SCO OpenServer 5 Development System (not the UDK)
71 + * defines syslog to std_syslog.
74 +#ifdef HAVE_STD_SYSLOG
75 +#define syslog std_syslog
78 +PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
82 + char *message = NULL;
83 + smart_string sbuf = {0};
86 + va_start(args, format);
87 + vspprintf(&message, 0, format, args);
90 + for (ptr = message; ; ++ptr) {
93 + syslog(priority, "%.*s", (int)sbuf.len, sbuf.c);
98 + smart_string_appendc(&sbuf, c);
100 + syslog(priority, "%.*s", (int)sbuf.len, sbuf.c);
101 + smart_string_reset(&sbuf);
106 + smart_string_free(&sbuf);
114 + * c-basic-offset: 4
116 + * vim600: sw=4 ts=4 fdm=marker
117 + * vim<600: sw=4 ts=4
119 diff --git a/main/php_syslog.h b/main/php_syslog.h
120 index 33f52a3..a09f98c 100644
121 --- a/main/php_syslog.h
122 +++ b/main/php_syslog.h
130 #include "win32/syslog.h"
137 - * The SCO OpenServer 5 Development System (not the UDK)
138 - * defines syslog to std_syslog.
143 -#ifdef HAVE_STD_SYSLOG
144 -#define php_syslog std_syslog
152 -#define php_syslog syslog
155 +PHPAPI void php_syslog(int, const char *format, ...);
159 diff --git a/win32/build/config.w32 b/win32/build/config.w32
160 index 1269c6e..f766e53 100644
161 --- a/win32/build/config.w32
162 +++ b/win32/build/config.w32
163 @@ -237,7 +237,8 @@ ADD_FLAG("CFLAGS_BD_ZEND", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
164 ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \
165 php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
166 strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \
167 - php_open_temporary_file.c output.c internal_functions.c php_sprintf.c");
168 + php_open_temporary_file.c output.c internal_functions.c php_sprintf.c \
170 ADD_FLAG("CFLAGS_BD_MAIN", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
171 ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");