From: Antony Dovgal Date: Mon, 20 Mar 2006 23:03:11 +0000 (+0000) Subject: fix #36808 (syslog ident becomes garbage between requests) X-Git-Tag: php-5.1.3RC2~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=edbfb9c2c7786f627227b8abeec1fd283c091317;p=php fix #36808 (syslog ident becomes garbage between requests) --- diff --git a/NEWS b/NEWS index 85021b244e..bd677afa71 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ PHP NEWS (also fixes bug #36764). (Tony) - Removed the E_STRICT deprecation notice from "var". (Ilia) - Fixed debug_zval_dump() to support private and protected members. (Dmitry) +- FIxed bug #36808 (syslog ident becomes garbage between requests). (Tony) - Fixed bug #36756 (DOMDocument::removeChild corrupts node). (Rob) - Fixed bug #36743 (In a class extending XMLReader array properties are not writable). (Tony) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 479af7e931..9943da6f80 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1150,6 +1150,7 @@ PHP_MSHUTDOWN_FUNCTION(basic) PHP_MSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(file)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(standard_filters)(SHUTDOWN_FUNC_ARGS_PASSTHRU); + PHP_MSHUTDOWN(syslog)(INIT_FUNC_ARGS_PASSTHRU); #if defined(HAVE_LOCALECONV) && defined(ZTS) PHP_MSHUTDOWN(localeconv)(SHUTDOWN_FUNC_ARGS_PASSTHRU); #endif diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h index 86b9704a4d..25b0e8424d 100644 --- a/ext/standard/php_ext_syslog.h +++ b/ext/standard/php_ext_syslog.h @@ -28,6 +28,7 @@ PHP_MINIT_FUNCTION(syslog); PHP_RINIT_FUNCTION(syslog); PHP_RSHUTDOWN_FUNCTION(syslog); +PHP_MSHUTDOWN_FUNCTION(syslog); PHP_FUNCTION(openlog); PHP_FUNCTION(syslog); diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index bde09e588a..b3057039e8 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -97,6 +97,7 @@ PHP_MINIT_FUNCTION(syslog) /* AIX doesn't have LOG_PERROR */ REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/ #endif + BG(syslog_device)=NULL; return SUCCESS; } @@ -109,22 +110,26 @@ PHP_RINIT_FUNCTION(syslog) } else { BG(syslog_started)=0; } - BG(syslog_device)=NULL; return SUCCESS; } PHP_RSHUTDOWN_FUNCTION(syslog) { - if (BG(syslog_device)) { - efree(BG(syslog_device)); - } #ifdef PHP_WIN32 closelog(); #endif return SUCCESS; } +PHP_MSHUTDOWN_FUNCTION(syslog) +{ + if (BG(syslog_device)) { + free(BG(syslog_device)); + } + return SUCCESS; +} + /* {{{ start_syslog */ static void start_syslog(TSRMLS_D) @@ -224,9 +229,9 @@ PHP_FUNCTION(openlog) return; } if (BG(syslog_device)) { - efree(BG(syslog_device)); + free(BG(syslog_device)); } - BG(syslog_device) = estrndup(ident, ident_len); + BG(syslog_device) = zend_strndup(ident, ident_len); openlog(BG(syslog_device), option, facility); RETURN_TRUE; } @@ -242,7 +247,7 @@ PHP_FUNCTION(closelog) closelog(); if (BG(syslog_device)) { - efree(BG(syslog_device)); + free(BG(syslog_device)); BG(syslog_device)=NULL; } RETURN_TRUE;