]> granicus.if.org Git - php/commitdiff
Fix for Bug #26757: session.save_path defaults to bogus value on win32
authorWez Furlong <wez@php.net>
Mon, 29 Mar 2004 21:44:07 +0000 (21:44 +0000)
committerWez Furlong <wez@php.net>
Mon, 29 Mar 2004 21:44:07 +0000 (21:44 +0000)
Merge from branch with one main difference: the default save_path is
set to the empty string on all platforms, whereas the code in the
branch only does so for win32.

ext/session/mod_files.c
ext/session/session.c
main/php_open_temporary_file.c
main/php_open_temporary_file.h
php.ini-dist
php.ini-recommended

index f4c35f927434129c38d1951fd470749702d4683c..15cd5d77475ea63288dce09a668b3dbb66411a4a 100644 (file)
@@ -46,6 +46,7 @@
 #include "php_session.h"
 #include "mod_files.h"
 #include "ext/standard/flock_compat.h"
+#include "php_open_temporary_file.h"
 
 #define FILE_PREFIX "sess_"
 
@@ -239,6 +240,11 @@ PS_OPEN_FUNC(files)
        size_t dirdepth = 0;
        int filemode = 0600;
 
+       if (*save_path == '\0') {
+               /* if save path is an empty string, determine the temporary dir */
+               save_path = php_get_temporary_directory();
+       }
+       
        /* split up input parameter */
        last = save_path;
        p = strchr(save_path, ';');
index 27bce4a2ba874389ace22722299bedd9d815e7f7..ca8365dcd8b4070386347f100daa90e69d10bfe3 100644 (file)
@@ -137,7 +137,7 @@ static PHP_INI_MH(OnUpdateSerializer)
 PHP_INI_BEGIN()
        STD_PHP_INI_BOOLEAN("session.bug_compat_42",    "1",         PHP_INI_ALL, OnUpdateBool,   bug_compat,         php_ps_globals,    ps_globals)
        STD_PHP_INI_BOOLEAN("session.bug_compat_warn",  "1",         PHP_INI_ALL, OnUpdateBool,   bug_compat_warn,    php_ps_globals,    ps_globals)
-       STD_PHP_INI_ENTRY("session.save_path",          "/tmp",      PHP_INI_ALL, OnUpdateString, save_path,          php_ps_globals,    ps_globals)
+       STD_PHP_INI_ENTRY("session.save_path",          "",          PHP_INI_ALL, OnUpdateString, save_path,          php_ps_globals,    ps_globals)
        STD_PHP_INI_ENTRY("session.name",               "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name,       php_ps_globals,    ps_globals)
        PHP_INI_ENTRY("session.save_handler",           "files",     PHP_INI_ALL, OnUpdateSaveHandler)
        STD_PHP_INI_BOOLEAN("session.auto_start",       "0",         PHP_INI_ALL, OnUpdateBool,   auto_start,         php_ps_globals,    ps_globals)
index a3db16deb6f7c16fada19f31e61092c276f3d661..b8c94528cd4035ef545816d54db40938369067fe 100644 (file)
@@ -164,7 +164,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char **
 /*
  *  Determine where to place temporary files.
  */
-const char* get_temporary_directory()
+PHPAPI const char* php_get_temporary_directory(void)
 {
        /* Cache the chosen temporary directory. */
        static char* temporary_directory;
@@ -231,7 +231,7 @@ PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char **opened
        fd = php_do_open_temporary_file(dir, pfx, opened_path_p TSRMLS_CC);
        if (fd == -1) {
                /* Use default temporary directory. */
-               fd = php_do_open_temporary_file(get_temporary_directory(), pfx, opened_path_p TSRMLS_CC);
+               fd = php_do_open_temporary_file(php_get_temporary_directory(), pfx, opened_path_p TSRMLS_CC);
        }
        return fd;
 }
index db1c5f84935193d5adf979b2fa6676e3a18b5d98..500d2429c3d6894437abcf3e5606e15feb778030 100644 (file)
@@ -24,6 +24,7 @@
 BEGIN_EXTERN_C()
 PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC);
 PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char **opened_path_p TSRMLS_DC);
+PHPAPI const char *php_get_temporary_directory(void);
 END_EXTERN_C()
 
 #endif /* PHP_OPEN_TEMPORARY_FILE_H */
index 41d86659b21b94dc555afb5cb9568b688c56e730..e98064e45c694ef66b93f2d7c3cc0a06d043fad3 100644 (file)
@@ -860,7 +860,7 @@ session.save_handler = files
 ;
 ; where MODE is the octal representation of the mode. Note that this
 ; does not overwrite the process's umask.
-session.save_path = "/tmp"
+;session.save_path = "/tmp"
 
 ; Whether to use cookies.
 session.use_cookies = 1
index 9584d54d8585d70d75e8f51858446f8058a816a9..7c6401f159e138883938f37ef3a03426d1736fa9 100644 (file)
@@ -882,7 +882,7 @@ session.save_handler = files
 ;
 ; where MODE is the octal representation of the mode. Note that this
 ; does not overwrite the process's umask.
-session.save_path = "/tmp"
+;session.save_path = "/tmp"
 
 ; Whether to use cookies.
 session.use_cookies = 1