wez Mon Mar 29 16:28:48 2004 EDT
Modified files: (Branch: PHP_4_3)
/php-src php.ini-dist php.ini-recommended
/php-src/ext/session mod_files.c session.c
/php-src/main php_open_temporary_file.c php_open_temporary_file.h
Log:
Fix for Bug #26757: session.save_path default is bogus for win32
Based on a patch found in the bug report.
Concept approved by Ilia.
http://cvs.php.net/diff.php/php-src/php.ini-dist?r1=1.171.2.19&r2=1.171.2.20&ty=u
Index: php-src/php.ini-dist
diff -u php-src/php.ini-dist:1.171.2.19 php-src/php.ini-dist:1.171.2.20
--- php-src/php.ini-dist:1.171.2.19 Mon Feb 9 19:03:43 2004
+++ php-src/php.ini-dist Mon Mar 29 16:28:47 2004
@@ -819,7 +819,7 @@
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if you choose to
; use subdirectories for session storage
-session.save_path = /tmp
+;session.save_path = /tmp
; Whether to use cookies.
session.use_cookies = 1
http://cvs.php.net/diff.php/php-src/php.ini-recommended?r1=1.119.2.17&r2=1.119.2.18&ty=u
Index: php-src/php.ini-recommended
diff -u php-src/php.ini-recommended:1.119.2.17 php-src/php.ini-recommended:1.119.2.18
--- php-src/php.ini-recommended:1.119.2.17 Mon Feb 9 19:03:43 2004
+++ php-src/php.ini-recommended Mon Mar 29 16:28:47 2004
@@ -825,7 +825,7 @@
; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
-session.save_path = /tmp
+;session.save_path = /tmp
; Whether to use cookies.
session.use_cookies = 1
http://cvs.php.net/diff.php/php-src/ext/session/mod_files.c?r1=1.83.2.7&r2=1.83.2.8&ty=u
Index: php-src/ext/session/mod_files.c
diff -u php-src/ext/session/mod_files.c:1.83.2.7
php-src/ext/session/mod_files.c:1.83.2.8
--- php-src/ext/session/mod_files.c:1.83.2.7 Thu Sep 25 10:53:58 2003
+++ php-src/ext/session/mod_files.c Mon Mar 29 16:28:47 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_files.c,v 1.83.2.7 2003/09/25 14:53:58 sniper Exp $ */
+/* $Id: mod_files.c,v 1.83.2.8 2004/03/29 21:28:47 wez Exp $ */
#include "php.h"
@@ -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_"
@@ -234,6 +235,10 @@
data = ecalloc(sizeof(*data), 1);
PS_SET_MOD_DATA(data);
+ if (*save_path == '\0') {
+ save_path = php_get_temporary_directory();
+ }
+
data->fd = -1;
if ((p = strchr(save_path, ';'))) {
errno = 0;
http://cvs.php.net/diff.php/php-src/ext/session/session.c?r1=1.336.2.36&r2=1.336.2.37&ty=u
Index: php-src/ext/session/session.c
diff -u php-src/ext/session/session.c:1.336.2.36
php-src/ext/session/session.c:1.336.2.37
--- php-src/ext/session/session.c:1.336.2.36 Sun Mar 28 09:57:31 2004
+++ php-src/ext/session/session.c Mon Mar 29 16:28:47 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: session.c,v 1.336.2.36 2004/03/28 14:57:31 rasmus Exp $ */
+/* $Id: session.c,v 1.336.2.37 2004/03/29 21:28:47 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -120,7 +120,11 @@
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)
+#ifdef PHP_WIN32
+ STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL,
OnUpdateString, save_path, php_ps_globals, ps_globals)
+#else
STD_PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL,
OnUpdateString, save_path, php_ps_globals, ps_globals)
+#endif
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)
http://cvs.php.net/diff.php/php-src/main/php_open_temporary_file.c?r1=1.18.2.8&r2=1.18.2.9&ty=u
Index: php-src/main/php_open_temporary_file.c
diff -u php-src/main/php_open_temporary_file.c:1.18.2.8
php-src/main/php_open_temporary_file.c:1.18.2.9
--- php-src/main/php_open_temporary_file.c:1.18.2.8 Fri Apr 25 14:11:42 2003
+++ php-src/main/php_open_temporary_file.c Mon Mar 29 16:28:47 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_open_temporary_file.c,v 1.18.2.8 2003/04/25 18:11:42 sniper Exp $ */
+/* $Id: php_open_temporary_file.c,v 1.18.2.9 2004/03/29 21:28:47 wez Exp $ */
#include "php.h"
@@ -166,7 +166,7 @@
/*
* 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;
@@ -233,7 +233,7 @@
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;
}
http://cvs.php.net/diff.php/php-src/main/php_open_temporary_file.h?r1=1.5.8.2&r2=1.5.8.3&ty=u
Index: php-src/main/php_open_temporary_file.h
diff -u php-src/main/php_open_temporary_file.h:1.5.8.2
php-src/main/php_open_temporary_file.h:1.5.8.3
--- php-src/main/php_open_temporary_file.h:1.5.8.2 Tue Mar 18 11:39:06 2003
+++ php-src/main/php_open_temporary_file.h Mon Mar 29 16:28:47 2004
@@ -21,5 +21,6 @@
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);
#endif /* PHP_OPEN_TEMPORARY_FILE_H */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php