summaryrefslogtreecommitdiff
path: root/ext/session
diff options
context:
space:
mode:
Diffstat (limited to 'ext/session')
-rw-r--r--ext/session/mod_files.c14
-rw-r--r--ext/session/mod_files.h4
-rw-r--r--ext/session/mod_mm.c4
-rw-r--r--ext/session/mod_mm.h4
-rw-r--r--ext/session/mod_user.c4
-rw-r--r--ext/session/mod_user.h4
-rw-r--r--ext/session/php_session.h4
-rw-r--r--ext/session/session.c33
-rw-r--r--ext/session/tests/001.phpt2
-rw-r--r--ext/session/tests/003.phpt2
-rw-r--r--ext/session/tests/004.phpt2
-rw-r--r--ext/session/tests/005.phpt2
-rw-r--r--ext/session/tests/006.phpt2
-rw-r--r--ext/session/tests/007.phpt5
-rw-r--r--ext/session/tests/008-php4.2.3.phpt2
-rw-r--r--ext/session/tests/009.phpt2
-rw-r--r--ext/session/tests/012.phpt2
-rw-r--r--ext/session/tests/013.phpt2
-rw-r--r--ext/session/tests/014.phpt2
-rw-r--r--ext/session/tests/019.phpt2
20 files changed, 51 insertions, 47 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 045acdfab..512f93ee6 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_files.c 280729 2009-05-18 16:10:09Z jani $ */
+/* $Id: mod_files.c 294027 2010-01-25 23:06:09Z johannes $ */
#include "php.h"
@@ -87,7 +87,9 @@ static int ps_files_valid_key(const char *key)
len = p - key;
- if (len == 0) {
+ /* Somewhat arbitrary length limit here, but should be way more than
+ anyone needs and avoids file-level warnings later on if we exceed MAX_PATH */
+ if (len == 0 || len > 128) {
ret = 0;
}
@@ -154,7 +156,7 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC)
ps_files_close(data);
if (!ps_files_valid_key(key)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The session id contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'");
PS(invalid_session_id) = 1;
return;
}
@@ -244,11 +246,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
/* check whether its last access was more than maxlifet ago */
if (VCWD_STAT(buf, &sbuf) == 0 &&
-#ifdef NETWARE
- (now - sbuf.st_mtime.tv_sec) > maxlifetime) {
-#else
(now - sbuf.st_mtime) > maxlifetime) {
-#endif
VCWD_UNLINK(buf);
nrdels++;
}
diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h
index 2522f6f28..bc5bb4c41 100644
--- a/ext/session/mod_files.h
+++ b/ext/session/mod_files.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_files.h 272370 2008-12-31 11:15:49Z sebastian $ */
+/* $Id: mod_files.h 293036 2010-01-03 09:23:27Z sebastian $ */
#ifndef MOD_FILES_H
#define MOD_FILES_H
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index 37623da39..a938c48f6 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_mm.c 280729 2009-05-18 16:10:09Z jani $ */
+/* $Id: mod_mm.c 293036 2010-01-03 09:23:27Z sebastian $ */
#include "php.h"
diff --git a/ext/session/mod_mm.h b/ext/session/mod_mm.h
index 983424f9f..a5c2c9935 100644
--- a/ext/session/mod_mm.h
+++ b/ext/session/mod_mm.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_mm.h 272370 2008-12-31 11:15:49Z sebastian $ */
+/* $Id: mod_mm.h 293036 2010-01-03 09:23:27Z sebastian $ */
#ifndef MOD_MM_H
#define MOD_MM_H
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index f1e922fd1..01f7f8ea8 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_user.c 280729 2009-05-18 16:10:09Z jani $ */
+/* $Id: mod_user.c 293036 2010-01-03 09:23:27Z sebastian $ */
#include "php.h"
#include "php_session.h"
diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h
index 3ee546e4d..2b0025021 100644
--- a/ext/session/mod_user.h
+++ b/ext/session/mod_user.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_user.h 272370 2008-12-31 11:15:49Z sebastian $ */
+/* $Id: mod_user.h 293036 2010-01-03 09:23:27Z sebastian $ */
#ifndef MOD_USER_H
#define MOD_USER_H
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 4dcab6c21..b321f4449 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_session.h 280729 2009-05-18 16:10:09Z jani $ */
+/* $Id: php_session.h 293036 2010-01-03 09:23:27Z sebastian $ */
#ifndef PHP_SESSION_H
#define PHP_SESSION_H
diff --git a/ext/session/session.c b/ext/session/session.c
index 05a66f231..0d8ddd00c 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2009 The PHP Group |
+ | Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: session.c 286443 2009-07-28 08:54:23Z tony2001 $ */
+/* $Id: session.c 294515 2010-02-04 09:40:38Z pajoye $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -61,12 +61,6 @@ PHPAPI ZEND_DECLARE_MODULE_GLOBALS(ps);
* Helpers *
*********** */
-#ifdef NETWARE
-# define SESS_SB_MTIME(sb) ((sb).st_mtime.tv_sec)
-#else
-# define SESS_SB_MTIME(sb) ((sb).st_mtime)
-#endif
-
#define IF_SESSION_VARS() \
if (PS(http_session_vars) && PS(http_session_vars)->type == IS_ARRAY)
@@ -693,17 +687,22 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
return FAILURE;
}
- if ((p = zend_memrchr(new_value, ';', new_value_length))) {
+ /* we do not use zend_memrchr() since path can contain ; itself */
+ if ((p = strchr(new_value, ';'))) {
+ char *p2;
p++;
+ if ((p2 = strchr(p, ';'))) {
+ p = p2 + 1;
+ }
} else {
p = new_value;
}
- if (PG(safe_mode) && (!php_checkuid(p, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ if (PG(safe_mode) && *p && (!php_checkuid(p, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
return FAILURE;
}
- if (PG(open_basedir) && php_check_open_basedir(p TSRMLS_CC)) {
+ if (PG(open_basedir) && *p && php_check_open_basedir(p TSRMLS_CC)) {
return FAILURE;
}
}
@@ -1095,7 +1094,7 @@ static inline void last_modified(TSRMLS_D) /* {{{ */
#define LAST_MODIFIED "Last-Modified: "
memcpy(buf, LAST_MODIFIED, sizeof(LAST_MODIFIED) - 1);
- strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &SESS_SB_MTIME(sb));
+ strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &sb.st_mtime);
ADD_HEADER(buf);
}
}
@@ -1888,7 +1887,10 @@ static PHP_FUNCTION(session_unset)
}
IF_SESSION_VARS() {
- HashTable *ht = Z_ARRVAL_P(PS(http_session_vars));
+ HashTable *ht;
+
+ SEPARATE_ZVAL_IF_NOT_REF(&PS(http_session_vars));
+ ht = Z_ARRVAL_P(PS(http_session_vars));
if (PG(register_globals)) {
uint str_len;
@@ -1966,7 +1968,10 @@ static PHP_FUNCTION(session_unregister)
return;
}
- PS_DEL_VARL(p_name, p_name_len);
+ IF_SESSION_VARS() {
+ SEPARATE_ZVAL_IF_NOT_REF(&PS(http_session_vars));
+ PS_DEL_VARL(p_name, p_name_len);
+ }
RETURN_TRUE;
}
diff --git a/ext/session/tests/001.phpt b/ext/session/tests/001.phpt
index 1007f40cc..19dff78e1 100644
--- a/ext/session/tests/001.phpt
+++ b/ext/session/tests/001.phpt
@@ -31,7 +31,7 @@ print session_encode()."\n";
session_destroy();
--EXPECTF--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
Deprecated: Function session_register() is deprecated in %s on line %d
diff --git a/ext/session/tests/003.phpt b/ext/session/tests/003.phpt
index 253b74062..8a4e0027f 100644
--- a/ext/session/tests/003.phpt
+++ b/ext/session/tests/003.phpt
@@ -28,7 +28,7 @@ var_dump($baz);
var_dump($arr);
session_destroy();
--EXPECT--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
object(foo)#1 (2) {
["bar"]=>
string(2) "ok"
diff --git a/ext/session/tests/004.phpt b/ext/session/tests/004.phpt
index 7a6116744..2ff675e7c 100644
--- a/ext/session/tests/004.phpt
+++ b/ext/session/tests/004.phpt
@@ -73,7 +73,7 @@ var_dump($arr);
session_destroy();
?>
--EXPECT--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
OPEN: PHPSESSID
READ: abtest
object(foo)#2 (2) {
diff --git a/ext/session/tests/005.phpt b/ext/session/tests/005.phpt
index 4b7386590..124f0a831 100644
--- a/ext/session/tests/005.phpt
+++ b/ext/session/tests/005.phpt
@@ -85,7 +85,7 @@ var_dump($baz); var_dump($arr); var_dump($c);
session_destroy();
?>
--EXPECTF--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
OPEN: PHPSESSID
READ: abtest
object(foo)#2 (2) {
diff --git a/ext/session/tests/006.phpt b/ext/session/tests/006.phpt
index 08327eacd..7c7af61b7 100644
--- a/ext/session/tests/006.phpt
+++ b/ext/session/tests/006.phpt
@@ -45,7 +45,7 @@ echo "values after session:\n";
var_dump($a,$b);
?>
--EXPECTF--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
original values:
object(a)#%d (1) {
["test"]=>
diff --git a/ext/session/tests/007.phpt b/ext/session/tests/007.phpt
index 64b5bc93b..9531b3dd8 100644
--- a/ext/session/tests/007.phpt
+++ b/ext/session/tests/007.phpt
@@ -50,8 +50,9 @@ var_dump($HTTP_SESSION_VARS);
session_destroy();
?>
--EXPECTF--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
-PHP Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+
+Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
Deprecated: Function session_register() is deprecated in %s on line %d
float(3.14)
diff --git a/ext/session/tests/008-php4.2.3.phpt b/ext/session/tests/008-php4.2.3.phpt
index fffc1d314..4fe938fbc 100644
--- a/ext/session/tests/008-php4.2.3.phpt
+++ b/ext/session/tests/008-php4.2.3.phpt
@@ -58,7 +58,7 @@ var_dump($HTTP_SESSION_VARS);
session_destroy();
?>
--EXPECTF--
-PHP Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
NULL
session_write_close(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively
array(1) {
diff --git a/ext/session/tests/009.phpt b/ext/session/tests/009.phpt
index 206d8cddb..705a2758f 100644
--- a/ext/session/tests/009.phpt
+++ b/ext/session/tests/009.phpt
@@ -43,7 +43,7 @@ var_dump($HTTP_SESSION_VARS);
session_destroy();
?>
--EXPECT--
-PHP Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
array(0) {
}
array(1) {
diff --git a/ext/session/tests/012.phpt b/ext/session/tests/012.phpt
index c6b94de50..32aeb29c1 100644
--- a/ext/session/tests/012.phpt
+++ b/ext/session/tests/012.phpt
@@ -32,7 +32,7 @@ session_destroy();
print "I live\n";
?>
--EXPECTF--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
Deprecated: Function session_register() is deprecated in %s on line %d
I live
diff --git a/ext/session/tests/013.phpt b/ext/session/tests/013.phpt
index 818699e75..ad6c14e13 100644
--- a/ext/session/tests/013.phpt
+++ b/ext/session/tests/013.phpt
@@ -24,5 +24,5 @@ session_destroy();
print "I live\n";
?>
--EXPECT--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
I live
diff --git a/ext/session/tests/014.phpt b/ext/session/tests/014.phpt
index eaeaab3bb..4e77a7aef 100644
--- a/ext/session/tests/014.phpt
+++ b/ext/session/tests/014.phpt
@@ -33,7 +33,7 @@ ini_set("session.use_trans_sid","1");
session_destroy();
?>
--EXPECTF--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
<a href="/link?PHPSESSID=abtest">
Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in %s on line %d
diff --git a/ext/session/tests/019.phpt b/ext/session/tests/019.phpt
index f4d763095..5bdd03b5c 100644
--- a/ext/session/tests/019.phpt
+++ b/ext/session/tests/019.phpt
@@ -47,7 +47,7 @@ var_dump($_SESSION);
session_destroy();
?>
--EXPECTF--
-PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
+Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
Deprecated: Function session_register() is deprecated in %s on line %d
array(2) {