PHP 4.0 Bug #5102 : segfault on request shutdown

From: Date: Wed, 26 Jul 2000 23:36:49 +0000
Subject: PHP 4.0 Bug #5102 : segfault on request shutdown
Groups: php.dev 
Request: Send a blank email to php-dev+get-26413@lists.php.net to get a copy of this message
Looks like I catched problem. It's in session.c handling of ini entries. There you have variables like entropy_file. Such variables are initialized TWICE! Once in PHP_MINIT_FUNCTION(session) (REGISTER_INI_ENTRIES(); is called there) and in php_rinit_session_globals... Deallocation is also done two times: in PHP_MSHUTDOWN_FUNCTION(session) (UNREGISTER_INI_ENTRIES(); is called there) and in php_rshutdown_session_globals... With this patch all works Ok (on first glance) but I'm not sure if it's correct fix: --- session.c Thu Jul 27 00:12:14 2000 +++ session.c Thu Jul 27 00:15:41 2000 @@ -1260,14 +1260,7 @@ { zend_hash_init(&PS(vars), 0, NULL, NULL, 0); PS(define_sid) = 0; - PS(save_path) = estrdup(INI_STR("session.save_path")); - PS(session_name) = estrdup(INI_STR("session.name")); - PS(entropy_file) = estrdup(INI_STR("session.entropy_file")); - PS(extern_referer_chk) = estrdup(INI_STR("session.referer_check")); PS(id) = NULL; - PS(cookie_path) = estrdup(INI_STR("session.cookie_path")); - PS(cookie_domain) = estrdup(INI_STR("session.cookie_domain")); - PS(cache_limiter) = estrdup(INI_STR("session.cache_limiter")); PS(nr_open_sessions) = 0; PS(mod_data) = NULL; } @@ -1278,13 +1271,6 @@ PS(mod)->close(&PS(mod_data)); if (PS(id)) efree(PS(id)); - efree(PS(entropy_file)); - efree(PS(extern_referer_chk)); - efree(PS(save_path)); - efree(PS(session_name)); - efree(PS(cache_limiter)); - efree(PS(cookie_path)); - efree(PS(cookie_domain)); zend_hash_destroy(&PS(vars)); }

« previous php.dev (#26413) next »