summaryrefslogtreecommitdiff
path: root/ext/session
diff options
context:
space:
mode:
Diffstat (limited to 'ext/session')
-rw-r--r--ext/session/mod_files.c13
-rw-r--r--ext/session/mod_files.h4
-rw-r--r--ext/session/mod_files.sh2
-rw-r--r--ext/session/mod_mm.c32
-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/package.xml2
-rw-r--r--ext/session/php_session.h13
-rw-r--r--ext/session/session.c90
-rw-r--r--ext/session/tests/008.phpt61
-rw-r--r--ext/session/tests/016.phpt6
12 files changed, 118 insertions, 117 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index c233118ca..9cba9f2ef 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 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,v 1.100.2.3.2.2 2006/08/08 14:54:49 iliaa Exp $ */
+/* $Id: mod_files.c,v 1.100.2.3.2.5 2007/03/03 15:07:31 iliaa Exp $ */
#include "php.h"
@@ -251,6 +251,15 @@ PS_OPEN_FUNC(files)
if (*save_path == '\0') {
/* if save path is an empty string, determine the temporary dir */
save_path = php_get_temporary_directory();
+
+ if (strcmp(save_path, "/tmp")) {
+ if (PG(safe_mode) && (!php_checkuid(save_path, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ return FAILURE;
+ }
+ if (php_check_open_basedir(save_path TSRMLS_CC)) {
+ return FAILURE;
+ }
+ }
}
/* split up input parameter */
diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h
index c5cc3177c..99ade933e 100644
--- a/ext/session/mod_files.h
+++ b/ext/session/mod_files.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 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,v 1.11.2.1 2006/01/01 12:50:12 sniper Exp $ */
+/* $Id: mod_files.h,v 1.11.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
#ifndef MOD_FILES_H
#define MOD_FILES_H
diff --git a/ext/session/mod_files.sh b/ext/session/mod_files.sh
index 6d9d5d949..1d2672847 100644
--- a/ext/session/mod_files.sh
+++ b/ext/session/mod_files.sh
@@ -20,5 +20,5 @@ fi
for i in $hash_chars; do
newpath="$1/$i"
mkdir $newpath || exit 1
- sh $0 $newpath `expr $2 - 1 $3`
+ sh $0 $newpath `expr $2 - 1` $3
done
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index 0014b81a0..a8859cad4 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 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,v 1.46.2.1 2006/01/01 12:50:12 sniper Exp $ */
+/* $Id: mod_mm.c,v 1.46.2.1.2.5 2007/02/27 03:28:16 iliaa Exp $ */
#include "php.h"
@@ -253,28 +253,34 @@ PHP_MINIT_FUNCTION(ps_mm)
{
int save_path_len = strlen(PS(save_path));
int mod_name_len = strlen(sapi_module.name);
+ int euid_len;
char *ps_mm_path, euid[30];
int ret;
ps_mm_instance = calloc(sizeof(*ps_mm_instance), 1);
- if (!ps_mm_instance)
+ if (!ps_mm_instance) {
return FAILURE;
+ }
- if (!sprintf(euid,"%d", geteuid()))
+ if (!(euid_len = slprintf(euid, sizeof(euid), "%d", geteuid()))) {
return FAILURE;
+ }
- /* Directory + '/' + File + Module Name + Effective UID + \0 */
- ps_mm_path = emalloc(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1);
+ /* Directory + '/' + File + Module Name + Effective UID + \0 */
+ ps_mm_path = emalloc(save_path_len + 1 + (sizeof(PS_MM_FILE) - 1) + mod_name_len + euid_len + 1);
- memcpy(ps_mm_path, PS(save_path), save_path_len + 1);
- if (save_path_len > 0 && ps_mm_path[save_path_len - 1] != DEFAULT_SLASH) {
+ memcpy(ps_mm_path, PS(save_path), save_path_len);
+ if (PS(save_path)[save_path_len - 1] != DEFAULT_SLASH) {
ps_mm_path[save_path_len] = DEFAULT_SLASH;
- ps_mm_path[save_path_len+1] = '\0';
+ save_path_len++;
}
- strcat(ps_mm_path, PS_MM_FILE);
- strcat(ps_mm_path, sapi_module.name);
- strcat(ps_mm_path, euid);
-
+ memcpy(ps_mm_path + save_path_len, PS_MM_FILE, sizeof(PS_MM_FILE) - 1);
+ save_path_len += sizeof(PS_MM_FILE) - 1;
+ memcpy(ps_mm_path + save_path_len, sapi_module.name, mod_name_len);
+ save_path_len += mod_name_len;
+ memcpy(ps_mm_path + save_path_len, euid, euid_len);
+ ps_mm_path[save_path_len + euid_len] = '\0';
+
ret = ps_mm_initialize(ps_mm_instance, ps_mm_path);
efree(ps_mm_path);
diff --git a/ext/session/mod_mm.h b/ext/session/mod_mm.h
index 8c3c31bd5..77ead68fb 100644
--- a/ext/session/mod_mm.h
+++ b/ext/session/mod_mm.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 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,v 1.12.2.1 2006/01/01 12:50:12 sniper Exp $ */
+/* $Id: mod_mm.h,v 1.12.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
#ifndef MOD_MM_H
#define MOD_MM_H
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index fd0f3a221..4c28a9cec 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 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,v 1.29.2.1 2006/01/01 12:50:12 sniper Exp $ */
+/* $Id: mod_user.c,v 1.29.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
#include "php.h"
#include "php_session.h"
diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h
index 2229ed412..e535cc848 100644
--- a/ext/session/mod_user.h
+++ b/ext/session/mod_user.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 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,v 1.14.2.1 2006/01/01 12:50:12 sniper Exp $ */
+/* $Id: mod_user.h,v 1.14.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
#ifndef MOD_USER_H
#define MOD_USER_H
diff --git a/ext/session/package.xml b/ext/session/package.xml
index e176dc3d8..fdf85fc44 100644
--- a/ext/session/package.xml
+++ b/ext/session/package.xml
@@ -28,7 +28,7 @@ applications and increase the appeal of your web site.
<version>5.0.0rc1</version>
<date>2004-03-19</date>
<notes>
-package.xml added to support intallation using pear installer
+package.xml added to support installation using pear installer
</notes>
<filelist>
<file role="doc" name="CREDITS"/>
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 13bf5998d..5ae237e74 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 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,v 1.101.2.2.2.3 2006/10/06 21:11:36 iliaa Exp $ */
+/* $Id: php_session.h,v 1.101.2.2.2.5 2007/02/06 00:01:18 iliaa Exp $ */
#ifndef PHP_SESSION_H
#define PHP_SESSION_H
@@ -223,11 +223,16 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
#define PS_ENCODE_LOOP(code) do { \
HashTable *_ht = Z_ARRVAL_P(PS(http_session_vars)); \
+ int key_type; \
\
for (zend_hash_internal_pointer_reset(_ht); \
- zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL) == HASH_KEY_IS_STRING; \
+ (key_type = zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT; \
zend_hash_move_forward(_ht)) { \
- key_length--; \
+ if (key_type == HASH_KEY_IS_LONG) { \
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Skipping numeric key %ld.", num_key); \
+ continue; \
+ } \
+ key_length--; \
if (php_get_session_var(key, key_length, &struc TSRMLS_CC) == SUCCESS) { \
code; \
} \
diff --git a/ext/session/session.c b/ext/session/session.c
index ea6b88f1d..2b4524687 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 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,v 1.417.2.8.2.16 2006/10/06 21:11:36 iliaa Exp $ */
+/* $Id: session.c,v 1.417.2.8.2.33 2007/04/04 19:52:19 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -153,13 +153,17 @@ static PHP_INI_MH(OnUpdateSaveDir)
if (stage == PHP_INI_STAGE_RUNTIME) {
char *p;
+ if (memchr(new_value, '\0', new_value_length) != NULL) {
+ return FAILURE;
+ }
+
if ((p = zend_memrchr(new_value, ';', new_value_length))) {
p++;
} else {
p = new_value;
}
- if (PG(safe_mode) && (!php_checkuid(p, NULL, CHECKUID_ALLOW_ONLY_DIR))) {
+ if (PG(safe_mode) && (!php_checkuid(p, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
return FAILURE;
}
@@ -272,7 +276,7 @@ PHP_MINFO_FUNCTION(session);
static void php_rinit_session_globals(TSRMLS_D);
static void php_rshutdown_session_globals(TSRMLS_D);
-static zend_bool php_session_destroy(TSRMLS_D);
+static int php_session_destroy(TSRMLS_D);
zend_module_entry session_module_entry = {
STANDARD_MODULE_HEADER,
@@ -324,9 +328,12 @@ PHPAPI void php_add_session_var(char *name, size_t namelen TSRMLS_DC)
if (PG(register_globals)) {
zval **sym_global = NULL;
- zend_hash_find(&EG(symbol_table), name, namelen + 1,
- (void *) &sym_global);
-
+ if (zend_hash_find(&EG(symbol_table), name, namelen + 1, (void *) &sym_global) == SUCCESS) {
+ if ((Z_TYPE_PP(sym_global) == IS_ARRAY && Z_ARRVAL_PP(sym_global) == &EG(symbol_table)) || *sym_global == PS(http_session_vars)) {
+ return;
+ }
+ }
+
if (sym_global == NULL && sym_track == NULL) {
zval *empty_var;
@@ -356,7 +363,10 @@ PHPAPI void php_set_session_var(char *name, size_t namelen, zval *state_val, php
if (PG(register_globals)) {
zval **old_symbol;
if (zend_hash_find(&EG(symbol_table),name,namelen+1,(void *)&old_symbol) == SUCCESS) {
-
+ if ((Z_TYPE_PP(old_symbol) == IS_ARRAY && Z_ARRVAL_PP(old_symbol) == &EG(symbol_table)) || *old_symbol == PS(http_session_vars)) {
+ return;
+ }
+
/*
* A global symbol with the same name exists already. That
* symbol might have been created by other means (e.g. $_GET).
@@ -465,13 +475,26 @@ PS_SERIALIZER_DECODE_FUNC(php_binary)
PHP_VAR_UNSERIALIZE_INIT(var_hash);
for (p = val; p < endptr; ) {
+ zval **tmp;
namelen = *p & (~PS_BIN_UNDEF);
+
+ if (namelen < 0 || namelen > PS_BIN_MAX || (p + namelen) >= endptr) {
+ return FAILURE;
+ }
+
has_value = *p & PS_BIN_UNDEF ? 0 : 1;
name = estrndup(p + 1, namelen);
-
+
p += namelen + 1;
-
+
+ if (zend_hash_find(&EG(symbol_table), name, namelen + 1, (void **) &tmp) == SUCCESS) {
+ if ((Z_TYPE_PP(tmp) == IS_ARRAY && Z_ARRVAL_PP(tmp) == &EG(symbol_table)) || *tmp == PS(http_session_vars)) {
+ efree(name);
+ continue;
+ }
+ }
+
if (has_value) {
ALLOC_INIT_ZVAL(current);
if (php_var_unserialize(&current, (const unsigned char **) &p, (const unsigned char *) endptr, &var_hash TSRMLS_CC)) {
@@ -500,7 +523,7 @@ PS_SERIALIZER_ENCODE_FUNC(php)
PHP_VAR_SERIALIZE_INIT(var_hash);
PS_ENCODE_LOOP(
- smart_str_appendl(&buf, key, (unsigned char) key_length);
+ smart_str_appendl(&buf, key, key_length);
if (memchr(key, PS_DELIMITER, key_length)) {
PHP_VAR_SERIALIZE_DESTROY(var_hash);
smart_str_free(&buf);
@@ -537,6 +560,7 @@ PS_SERIALIZER_DECODE_FUNC(php)
p = val;
while (p < endptr) {
+ zval **tmp;
q = p;
while (*q != PS_DELIMITER)
if (++q >= endptr) goto break_outer_loop;
@@ -551,17 +575,23 @@ PS_SERIALIZER_DECODE_FUNC(php)
namelen = q - p;
name = estrndup(p, namelen);
q++;
-
+
+ if (zend_hash_find(&EG(symbol_table), name, namelen + 1, (void **) &tmp) == SUCCESS) {
+ if ((Z_TYPE_PP(tmp) == IS_ARRAY && Z_ARRVAL_PP(tmp) == &EG(symbol_table)) || *tmp == PS(http_session_vars)) {
+ goto skip;
+ }
+ }
+
if (has_value) {
ALLOC_INIT_ZVAL(current);
if (php_var_unserialize(&current, (const unsigned char **) &q, (const unsigned char *) endptr, &var_hash TSRMLS_CC)) {
- php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
+ php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC);
}
zval_ptr_dtor(&current);
}
PS_ADD_VARL(name, namelen);
+skip:
efree(name);
-
p = q;
}
break_outer_loop:
@@ -579,16 +609,20 @@ static void php_session_track_init(TSRMLS_D)
zend_delete_global_variable("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS")-1 TSRMLS_CC);
zend_delete_global_variable("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC);
+ if (PS(http_session_vars)) {
+ zval_ptr_dtor(&PS(http_session_vars));
+ }
+
MAKE_STD_ZVAL(session_vars);
array_init(session_vars);
PS(http_session_vars) = session_vars;
if (PG(register_long_arrays)) {
- ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 2, 1);
- ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
+ ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 3, 1);
+ ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 3, 1);
}
else {
- ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 1, 0);
+ ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
}
}
@@ -697,10 +731,8 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS)
remote_addr = Z_STRVAL_PP(token);
}
- buf = emalloc(100);
-
/* maximum 15+19+19+10 bytes */
- sprintf(buf, "%.15s%ld%ld%0.8f", remote_addr ? remote_addr : "",
+ spprintf(&buf, 0, "%.15s%ld%ld%0.8F", remote_addr ? remote_addr : "",
tv.tv_sec, (long int)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10);
switch (PS(hash_func)) {
@@ -814,6 +846,7 @@ new_session:
} else if (PS(invalid_session_id)) { /* address instances where the session read fails due to an invalid id */
PS(invalid_session_id) = 0;
efree(PS(id));
+ PS(id) = NULL;
goto new_session;
}
}
@@ -918,7 +951,7 @@ static void strcpy_gmt(char *ubuf, time_t *when)
php_gmtime_r(when, &tm);
- n = sprintf(buf, "%s, %02d %s %d %02d:%02d:%02d GMT", /* SAFE */
+ n = slprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* SAFE */
week_days[tm.tm_wday], tm.tm_mday,
month_names[tm.tm_mon], tm.tm_year + 1900,
tm.tm_hour, tm.tm_min,
@@ -963,7 +996,7 @@ CACHE_LIMITER_FUNC(public)
strcpy_gmt(buf + sizeof(EXPIRES) - 1, &now);
ADD_HEADER(buf);
- sprintf(buf, "Cache-Control: public, max-age=%ld", PS(cache_expire) * 60); /* SAFE */
+ snprintf(buf, sizeof(buf) , "Cache-Control: public, max-age=%ld", PS(cache_expire) * 60); /* SAFE */
ADD_HEADER(buf);
last_modified(TSRMLS_C);
@@ -973,7 +1006,7 @@ CACHE_LIMITER_FUNC(private_no_expire)
{
char buf[MAX_STR + 1];
- sprintf(buf, "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) * 60, PS(cache_expire) * 60); /* SAFE */
+ snprintf(buf, sizeof(buf), "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) * 60, PS(cache_expire) * 60); /* SAFE */
ADD_HEADER(buf);
last_modified(TSRMLS_C);
@@ -1300,9 +1333,9 @@ PHPAPI void php_session_start(TSRMLS_D)
}
}
-static zend_bool php_session_destroy(TSRMLS_D)
+static int php_session_destroy(TSRMLS_D)
{
- zend_bool retval = SUCCESS;
+ int retval = SUCCESS;
if (PS(session_status) != php_session_active) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to destroy uninitialized session");
@@ -1528,7 +1561,7 @@ PHP_FUNCTION(session_regenerate_id)
zend_bool del_ses = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &del_ses) == FAILURE) {
- WRONG_PARAM_COUNT;
+ return;
}
if (SG(headers_sent)) {
@@ -1543,6 +1576,7 @@ PHP_FUNCTION(session_regenerate_id)
RETURN_FALSE;
}
efree(PS(id));
+ PS(id) = NULL;
}
PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
@@ -1824,6 +1858,10 @@ static void php_rinit_session_globals(TSRMLS_D)
static void php_rshutdown_session_globals(TSRMLS_D)
{
+ if (PS(http_session_vars)) {
+ zval_ptr_dtor(&PS(http_session_vars));
+ PS(http_session_vars) = NULL;
+ }
if (PS(mod_data)) {
zend_try {
PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
diff --git a/ext/session/tests/008.phpt b/ext/session/tests/008.phpt
deleted file mode 100644
index 044a6f253..000000000
--- a/ext/session/tests/008.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-bug compatibility: global is used albeit register_globals=0
---SKIPIF--
-<?php include('skipif.inc');
- if (version_compare(PHP_VERSION,"4.2.3-dev", ">=")) die("skip this is for PHP < 4.2.3");
-?>
---INI--
-session.use_cookies=0
-session.cache_limiter=
-register_globals=0
-session.bug_compat_42=1
-session.bug_compat_warn=0
---FILE--
-<?php
-error_reporting(E_ALL & ~E_NOTICE);
-
-session_id("abtest");
-
-### Phase 1 cleanup
-session_start();
-session_destroy();
-
-### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
-session_id("abtest");
-session_register("c");
-var_dump($c);
-unset($c);
-$c = 3.14;
-session_write_close();
-unset($HTTP_SESSION_VARS);
-unset($c);
-
-### Phase 3 $HTTP_SESSION_VARS["c"] is set
-session_start();
-var_dump($HTTP_SESSION_VARS);
-unset($c);
-$c = 2.78;
-
-session_write_close();
-unset($HTTP_SESSION_VARS);
-unset($c);
-
-### Phase 4 final
-
-session_start();
-var_dump($c);
-var_dump($HTTP_SESSION_VARS);
-
-session_destroy();
-?>
---EXPECT--
-NULL
-array(1) {
- ["c"]=>
- float(3.14)
-}
-NULL
-array(1) {
- ["c"]=>
- float(3.14)
-}
diff --git a/ext/session/tests/016.phpt b/ext/session/tests/016.phpt
index 21cd0ec92..83703294a 100644
--- a/ext/session/tests/016.phpt
+++ b/ext/session/tests/016.phpt
@@ -1,7 +1,11 @@
--TEST--
invalid session.save_path should not cause a segfault
--SKIPIF--
-<?php include('skipif.inc'); ?>
+<?php
+if (!extension_loaded("session")) {
+ die("skip Session module not loaded");
+}
+?>
--INI--
session.save_path="123;:/really\\completely:::/invalid;;,23123;213"
session.use_cookies=0