Fix #78212: Segfault in built-in webserver

Since syslog's ident and facility parameters have been added to
config[1], vsyslog() segfaults on Windows, if openlog() has not been
called before.  We bring back the removed lines to fix this.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=2475337bd8a0fad0dac03db3f5e7e9d331d53653>
This commit is contained in:
Christoph M. Becker 2019-06-27 11:34:51 +02:00
parent e7a83ec8df
commit fa65f5ecf5
2 changed files with 5 additions and 0 deletions

1
NEWS
View file

@ -4,6 +4,7 @@ PHP NEWS
- Core: - Core:
. Added syslog.filter=raw option. (Erik Lundin) . Added syslog.filter=raw option. (Erik Lundin)
. Fixed bug #78212 (Segfault in built-in webserver). (cmb)
- Date: - Date:
. Fixed #69044 (discrepency between time and microtime). (krakjoe) . Fixed #69044 (discrepency between time and microtime). (krakjoe)

View file

@ -95,6 +95,10 @@ void vsyslog(int priority, const char *message, va_list args)
DWORD evid; DWORD evid;
wchar_t *strsw[2]; wchar_t *strsw[2];
/* default event source */
if (INVALID_HANDLE_VALUE == PW32G(log_source))
openlog("php", LOG_PID, LOG_SYSLOG);
switch (priority) { /* translate UNIX type into NT type */ switch (priority) { /* translate UNIX type into NT type */
case LOG_ALERT: case LOG_ALERT:
etype = EVENTLOG_ERROR_TYPE; etype = EVENTLOG_ERROR_TYPE;