#include "php_session.h"
#include "mod_files.h"
#include "ext/standard/flock_compat.h"
+#include "php_open_temporary_file.h"
#define FILE_PREFIX "sess_"
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, ';');
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)
/*
* 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;
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;
}
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 */
;
; 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
;
; 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