]> granicus.if.org Git - php/commitdiff
fix #36808 (syslog ident becomes garbage between requests)
authorAntony Dovgal <tony2001@php.net>
Mon, 20 Mar 2006 23:03:11 +0000 (23:03 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 20 Mar 2006 23:03:11 +0000 (23:03 +0000)
NEWS
ext/standard/basic_functions.c
ext/standard/php_ext_syslog.h
ext/standard/syslog.c

diff --git a/NEWS b/NEWS
index 85021b244ec78c0f139c4a9b75b5404297c25db0..bd677afa71615b517759a047b9e01cb3e45b4713 100644 (file)
--- 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)
index 479af7e9313480cfc9fb2581e06ba02c42af67d0..9943da6f8026cf81e54ad2068874e169ccc821c2 100644 (file)
@@ -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
index 86b9704a4d5090a40e109b07fdbf5aa0b2b5af6e..25b0e8424db11e9e83b229fda3c226c36872915c 100644 (file)
@@ -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);
index bde09e588a23bad5958368a7e18d4c300d3b4289..b3057039e83cacfddf4ee0c2382d3847d75835b9 100644 (file)
@@ -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;