summaryrefslogtreecommitdiff
path: root/ext/session
diff options
context:
space:
mode:
Diffstat (limited to 'ext/session')
-rw-r--r--ext/session/config.m44
-rw-r--r--ext/session/mod_files.c20
-rw-r--r--ext/session/mod_files.h2
-rw-r--r--ext/session/mod_mm.c4
-rw-r--r--ext/session/mod_mm.h2
-rw-r--r--ext/session/mod_user.c2
-rw-r--r--ext/session/mod_user.h2
-rw-r--r--ext/session/mod_user_class.c69
-rw-r--r--ext/session/php_session.h11
-rw-r--r--ext/session/session.c440
-rw-r--r--ext/session/session.stub.php110
-rw-r--r--ext/session/session_arginfo.h228
-rw-r--r--ext/session/tests/001.phpt4
-rw-r--r--ext/session/tests/003.phpt4
-rw-r--r--ext/session/tests/004.phpt2
-rw-r--r--ext/session/tests/005.phpt6
-rw-r--r--ext/session/tests/017.phpt8
-rw-r--r--ext/session/tests/019.phpt14
-rw-r--r--ext/session/tests/022.phpt4
-rw-r--r--ext/session/tests/023.phpt4
-rw-r--r--ext/session/tests/024.phpt2
-rw-r--r--ext/session/tests/025.phpt2
-rw-r--r--ext/session/tests/bug31454.phpt12
-rw-r--r--ext/session/tests/bug32330.phpt24
-rw-r--r--ext/session/tests/bug60634.phpt20
-rw-r--r--ext/session/tests/bug60634_error_1.phpt10
-rw-r--r--ext/session/tests/bug60634_error_2.phpt10
-rw-r--r--ext/session/tests/bug60634_error_3.phpt10
-rw-r--r--ext/session/tests/bug60634_error_4.phpt10
-rw-r--r--ext/session/tests/bug60634_error_5.phpt8
-rw-r--r--ext/session/tests/bug71162.phpt12
-rw-r--r--ext/session/tests/bug71972.phpt8
-rw-r--r--ext/session/tests/bug72562.phpt12
-rw-r--r--ext/session/tests/bug73529.phpt22
-rw-r--r--ext/session/tests/bug74514.phpt2
-rw-r--r--ext/session/tests/bug74541.phpt2
-rw-r--r--ext/session/tests/bug74833.phpt2
-rw-r--r--ext/session/tests/bug74892.phpt2
-rw-r--r--ext/session/tests/bug74936.phpt2
-rw-r--r--ext/session/tests/bug74941.phpt2
-rw-r--r--ext/session/tests/bug78624.phpt6
-rw-r--r--ext/session/tests/bug79221.phpt2
-rw-r--r--ext/session/tests/save_handler_closures.inc2
-rw-r--r--ext/session/tests/session_abort_basic.phpt6
-rw-r--r--ext/session/tests/session_basic1.phpt6
-rw-r--r--ext/session/tests/session_basic2.phpt6
-rw-r--r--ext/session/tests/session_basic3.phpt6
-rw-r--r--ext/session/tests/session_basic4.phpt6
-rw-r--r--ext/session/tests/session_basic5.phpt6
-rw-r--r--ext/session/tests/session_cache_expire_basic.phpt6
-rw-r--r--ext/session/tests/session_cache_expire_error.phpt169
-rw-r--r--ext/session/tests/session_cache_expire_variation1.phpt6
-rw-r--r--ext/session/tests/session_cache_expire_variation2.phpt6
-rw-r--r--ext/session/tests/session_cache_expire_variation3.phpt6
-rw-r--r--ext/session/tests/session_cache_limiter_basic.phpt6
-rw-r--r--ext/session/tests/session_cache_limiter_error.phpt171
-rw-r--r--ext/session/tests/session_cache_limiter_variation1.phpt8
-rw-r--r--ext/session/tests/session_cache_limiter_variation2.phpt8
-rw-r--r--ext/session/tests/session_cache_limiter_variation3.phpt8
-rw-r--r--ext/session/tests/session_commit_basic.phpt6
-rw-r--r--ext/session/tests/session_commit_variation1.phpt6
-rw-r--r--ext/session/tests/session_commit_variation2.phpt6
-rw-r--r--ext/session/tests/session_commit_variation3.phpt6
-rw-r--r--ext/session/tests/session_commit_variation4.phpt6
-rw-r--r--ext/session/tests/session_commit_variation5.phpt6
-rw-r--r--ext/session/tests/session_create_id_basic.phpt6
-rw-r--r--ext/session/tests/session_decode_basic.phpt6
-rw-r--r--ext/session/tests/session_decode_basic_serialize.phpt6
-rw-r--r--ext/session/tests/session_decode_error2.phpt254
-rw-r--r--ext/session/tests/session_decode_variation1.phpt6
-rw-r--r--ext/session/tests/session_decode_variation2.phpt6
-rw-r--r--ext/session/tests/session_decode_variation3.phpt8
-rw-r--r--ext/session/tests/session_decode_variation4.phpt24
-rw-r--r--ext/session/tests/session_destroy_variation1.phpt6
-rw-r--r--ext/session/tests/session_destroy_variation2.phpt6
-rw-r--r--ext/session/tests/session_destroy_variation3.phpt6
-rw-r--r--ext/session/tests/session_encode_basic.phpt6
-rw-r--r--ext/session/tests/session_encode_error2.phpt17
-rw-r--r--ext/session/tests/session_encode_variation1.phpt6
-rw-r--r--ext/session/tests/session_encode_variation2.phpt6
-rw-r--r--ext/session/tests/session_encode_variation3.phpt6
-rw-r--r--ext/session/tests/session_encode_variation4.phpt6
-rw-r--r--ext/session/tests/session_encode_variation5.phpt6
-rw-r--r--ext/session/tests/session_encode_variation6.phpt6
-rw-r--r--ext/session/tests/session_encode_variation7.phpt6
-rw-r--r--ext/session/tests/session_encode_variation8.phpt6
-rw-r--r--ext/session/tests/session_gc_basic.phpt6
-rw-r--r--ext/session/tests/session_get_cookie_params_basic.phpt6
-rw-r--r--ext/session/tests/session_get_cookie_params_variation1.phpt6
-rw-r--r--ext/session/tests/session_id_basic.phpt6
-rw-r--r--ext/session/tests/session_id_basic2.phpt6
-rw-r--r--ext/session/tests/session_id_error2.phpt6
-rw-r--r--ext/session/tests/session_id_error3.phpt6
-rw-r--r--ext/session/tests/session_module_name_basic.phpt6
-rw-r--r--ext/session/tests/session_module_name_variation1.phpt6
-rw-r--r--ext/session/tests/session_module_name_variation2.phpt6
-rw-r--r--ext/session/tests/session_module_name_variation3.phpt14
-rw-r--r--ext/session/tests/session_module_name_variation4.phpt6
-rw-r--r--ext/session/tests/session_name_basic.phpt6
-rw-r--r--ext/session/tests/session_name_variation1.phpt6
-rw-r--r--ext/session/tests/session_name_variation2.phpt6
-rw-r--r--ext/session/tests/session_regenerate_id_basic.phpt6
-rw-r--r--ext/session/tests/session_regenerate_id_cookie.phpt28
-rw-r--r--ext/session/tests/session_regenerate_id_variation1.phpt6
-rw-r--r--ext/session/tests/session_reset_basic.phpt6
-rw-r--r--ext/session/tests/session_save_path_basic.phpt6
-rw-r--r--ext/session/tests/session_save_path_variation1.phpt8
-rw-r--r--ext/session/tests/session_save_path_variation2.phpt6
-rw-r--r--ext/session/tests/session_save_path_variation3.phpt6
-rw-r--r--ext/session/tests/session_save_path_variation4.phpt19
-rw-r--r--ext/session/tests/session_save_path_variation5.phpt10
-rw-r--r--ext/session/tests/session_set_cookie_params_basic.phpt8
-rw-r--r--ext/session/tests/session_set_cookie_params_variation1.phpt8
-rw-r--r--ext/session/tests/session_set_cookie_params_variation2.phpt8
-rw-r--r--ext/session/tests/session_set_cookie_params_variation3.phpt8
-rw-r--r--ext/session/tests/session_set_cookie_params_variation4.phpt8
-rw-r--r--ext/session/tests/session_set_cookie_params_variation5.phpt8
-rw-r--r--ext/session/tests/session_set_cookie_params_variation6.phpt8
-rw-r--r--ext/session/tests/session_set_cookie_params_variation7.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_basic.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_class_001.phpt108
-rw-r--r--ext/session/tests/session_set_save_handler_class_002.phpt78
-rw-r--r--ext/session/tests/session_set_save_handler_class_003.phpt32
-rw-r--r--ext/session/tests/session_set_save_handler_class_004.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_class_005.phpt24
-rw-r--r--ext/session/tests/session_set_save_handler_class_006.phpt26
-rw-r--r--ext/session/tests/session_set_save_handler_class_007.phpt50
-rw-r--r--ext/session/tests/session_set_save_handler_class_008.phpt50
-rw-r--r--ext/session/tests/session_set_save_handler_class_009.phpt50
-rw-r--r--ext/session/tests/session_set_save_handler_class_010.phpt50
-rw-r--r--ext/session/tests/session_set_save_handler_class_011.phpt60
-rw-r--r--ext/session/tests/session_set_save_handler_class_012.phpt54
-rw-r--r--ext/session/tests/session_set_save_handler_class_013.phpt43
-rw-r--r--ext/session/tests/session_set_save_handler_class_014.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_class_015.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_class_016.phpt82
-rw-r--r--ext/session/tests/session_set_save_handler_class_017.phpt92
-rw-r--r--ext/session/tests/session_set_save_handler_class_018.phpt100
-rw-r--r--ext/session/tests/session_set_save_handler_closures.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_error.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_error2.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_error3.phpt14
-rw-r--r--ext/session/tests/session_set_save_handler_error4.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_iface_001.phpt76
-rw-r--r--ext/session/tests/session_set_save_handler_iface_002.phpt107
-rw-r--r--ext/session/tests/session_set_save_handler_iface_003.phpt94
-rw-r--r--ext/session/tests/session_set_save_handler_sid_001.phpt90
-rw-r--r--ext/session/tests/session_set_save_handler_sid_002.phpt78
-rw-r--r--ext/session/tests/session_set_save_handler_variation1.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_variation2.phpt8
-rw-r--r--ext/session/tests/session_set_save_handler_variation3.phpt10
-rw-r--r--ext/session/tests/session_set_save_handler_variation4.phpt12
-rw-r--r--ext/session/tests/session_set_save_handler_variation5.phpt12
-rw-r--r--ext/session/tests/session_set_save_handler_variation6.phpt6
-rw-r--r--ext/session/tests/session_start_variation1.phpt14
-rw-r--r--ext/session/tests/session_start_variation2.phpt6
-rw-r--r--ext/session/tests/session_start_variation3.phpt8
-rw-r--r--ext/session/tests/session_start_variation4.phpt6
-rw-r--r--ext/session/tests/session_start_variation5.phpt6
-rw-r--r--ext/session/tests/session_start_variation6.phpt6
-rw-r--r--ext/session/tests/session_start_variation7.phpt6
-rw-r--r--ext/session/tests/session_start_variation8.phpt6
-rw-r--r--ext/session/tests/session_start_variation9.phpt8
-rw-r--r--ext/session/tests/session_unset_basic.phpt6
-rw-r--r--ext/session/tests/session_unset_variation1.phpt6
-rw-r--r--ext/session/tests/session_write_close_basic.phpt6
-rw-r--r--ext/session/tests/session_write_close_variation1.phpt6
-rw-r--r--ext/session/tests/session_write_close_variation2.phpt6
-rw-r--r--ext/session/tests/session_write_close_variation3.phpt6
-rw-r--r--ext/session/tests/session_write_close_variation4.phpt6
-rw-r--r--ext/session/tests/skipif.inc22
171 files changed, 1375 insertions, 2471 deletions
diff --git a/ext/session/config.m4 b/ext/session/config.m4
index 198c94c739..7abc8813b7 100644
--- a/ext/session/config.m4
+++ b/ext/session/config.m4
@@ -31,9 +31,9 @@ if test "$PHP_MM" != "no"; then
AC_MSG_ERROR(cannot find mm library)
fi
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
dnl The mm library is not thread-safe, and mod_mm.c refuses to compile.
- AC_MSG_ERROR(--with-mm cannot be combined with --enable-maintainer-zts)
+ AC_MSG_ERROR(--with-mm cannot be combined with --enable-zts)
fi
PHP_ADD_LIBRARY_WITH_PATH(mm, $MM_DIR/$PHP_LIBDIR, SESSION_SHARED_LIBADD)
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index cb8138e60a..bac6c4297d 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -57,11 +55,11 @@
#include <sys/stat.h>
#include <sys/types.h>
-#if HAVE_SYS_FILE_H
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
-#if HAVE_DIRENT_H
+#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
@@ -73,7 +71,7 @@
#include <fcntl.h>
#include <errno.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -245,7 +243,7 @@ static int ps_files_write(ps_files *data, zend_string *key, zend_string *val)
php_ignore_value(ftruncate(data->fd, 0));
}
-#if defined(HAVE_PWRITE)
+#ifdef HAVE_PWRITE
n = pwrite(data->fd, ZSTR_VAL(val), ZSTR_LEN(val), 0);
#else
lseek(data->fd, 0, SEEK_SET);
@@ -271,9 +269,9 @@ static int ps_files_write(ps_files *data, zend_string *key, zend_string *val)
if (n != ZSTR_LEN(val)) {
if (n == (size_t)-1) {
- php_error_docref(NULL, E_WARNING, "write failed: %s (%d)", strerror(errno), errno);
+ php_error_docref(NULL, E_WARNING, "Write failed: %s (%d)", strerror(errno), errno);
} else {
- php_error_docref(NULL, E_WARNING, "write wrote less bytes than requested");
+ php_error_docref(NULL, E_WARNING, "Write wrote less bytes than requested");
}
return FAILURE;
}
@@ -496,7 +494,7 @@ PS_READ_FUNC(files)
*val = zend_string_alloc(sbuf.st_size, 0);
-#if defined(HAVE_PREAD)
+#ifdef HAVE_PREAD
n = pread(data->fd, ZSTR_VAL(*val), ZSTR_LEN(*val), 0);
#else
lseek(data->fd, 0, SEEK_SET);
@@ -523,9 +521,9 @@ PS_READ_FUNC(files)
if (n != (zend_long)sbuf.st_size) {
if (n == -1) {
- php_error_docref(NULL, E_WARNING, "read failed: %s (%d)", strerror(errno), errno);
+ php_error_docref(NULL, E_WARNING, "Read failed: %s (%d)", strerror(errno), errno);
} else {
- php_error_docref(NULL, E_WARNING, "read returned less bytes than requested");
+ php_error_docref(NULL, E_WARNING, "Read returned less bytes than requested");
}
zend_string_release_ex(*val, 0);
*val = ZSTR_EMPTY_ALLOC();
diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h
index fc12f6d96e..120a2e8a0a 100644
--- a/ext/session/mod_files.h
+++ b/ext/session/mod_files.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index 93cfde7633..6698c307e0 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -403,7 +401,7 @@ PS_WRITE_FUNC(mm)
if (!sd->data) {
ps_sd_destroy(data, sd);
- php_error_docref(NULL, E_WARNING, "cannot allocate new data segment");
+ php_error_docref(NULL, E_WARNING, "Cannot allocate new data segment");
sd = NULL;
}
}
diff --git a/ext/session/mod_mm.h b/ext/session/mod_mm.h
index b09b39f62b..125f32a4a6 100644
--- a/ext/session/mod_mm.h
+++ b/ext/session/mod_mm.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index b66ac26c81..c3e5c608aa 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h
index af002c01f9..897d825adc 100644
--- a/ext/session/mod_user.h
+++ b/ext/session/mod_user.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c
index 5452dd3c7b..4c40028b2f 100644
--- a/ext/session/mod_user_class.c
+++ b/ext/session/mod_user_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -36,8 +34,7 @@
RETURN_FALSE; \
}
-/* {{{ proto bool SessionHandler::open(string save_path, string session_name)
- Wraps the old open handler */
+/* {{{ Wraps the old open handler */
PHP_METHOD(SessionHandler, open)
{
char *save_path = NULL, *session_name = NULL;
@@ -47,7 +44,7 @@ PHP_METHOD(SessionHandler, open)
PS_SANITY_CHECK;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &save_path, &save_path_len, &session_name, &session_name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PS(mod_user_is_open) = 1;
@@ -63,8 +60,7 @@ PHP_METHOD(SessionHandler, open)
}
/* }}} */
-/* {{{ proto bool SessionHandler::close()
- Wraps the old close handler */
+/* {{{ Wraps the old close handler */
PHP_METHOD(SessionHandler, close)
{
int ret;
@@ -88,8 +84,7 @@ PHP_METHOD(SessionHandler, close)
}
/* }}} */
-/* {{{ proto bool SessionHandler::read(string id)
- Wraps the old read handler */
+/* {{{ Wraps the old read handler */
PHP_METHOD(SessionHandler, read)
{
zend_string *val;
@@ -98,7 +93,7 @@ PHP_METHOD(SessionHandler, read)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(default_mod)->s_read(&PS(mod_data), key, &val, PS(gc_maxlifetime)) == FAILURE) {
@@ -109,8 +104,7 @@ PHP_METHOD(SessionHandler, read)
}
/* }}} */
-/* {{{ proto bool SessionHandler::write(string id, string data)
- Wraps the old write handler */
+/* {{{ Wraps the old write handler */
PHP_METHOD(SessionHandler, write)
{
zend_string *key, *val;
@@ -118,15 +112,14 @@ PHP_METHOD(SessionHandler, write)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &key, &val) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(SUCCESS == PS(default_mod)->s_write(&PS(mod_data), key, val, PS(gc_maxlifetime)));
}
/* }}} */
-/* {{{ proto bool SessionHandler::destroy(string id)
- Wraps the old destroy handler */
+/* {{{ Wraps the old destroy handler */
PHP_METHOD(SessionHandler, destroy)
{
zend_string *key;
@@ -134,15 +127,14 @@ PHP_METHOD(SessionHandler, destroy)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(SUCCESS == PS(default_mod)->s_destroy(&PS(mod_data), key));
}
/* }}} */
-/* {{{ proto bool SessionHandler::gc(int maxlifetime)
- Wraps the old gc handler */
+/* {{{ Wraps the old gc handler */
PHP_METHOD(SessionHandler, gc)
{
zend_long maxlifetime;
@@ -151,7 +143,7 @@ PHP_METHOD(SessionHandler, gc)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &maxlifetime) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(default_mod)->s_gc(&PS(mod_data), maxlifetime, &nrdels) == FAILURE) {
@@ -161,8 +153,7 @@ PHP_METHOD(SessionHandler, gc)
}
/* }}} */
-/* {{{ proto char SessionHandler::create_sid()
- Wraps the old create_sid handler */
+/* {{{ Wraps the old create_sid handler */
PHP_METHOD(SessionHandler, create_sid)
{
zend_string *id;
@@ -170,7 +161,7 @@ PHP_METHOD(SessionHandler, create_sid)
PS_SANITY_CHECK;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
id = PS(default_mod)->s_create_sid(&PS(mod_data));
@@ -178,37 +169,3 @@ PHP_METHOD(SessionHandler, create_sid)
RETURN_STR(id);
}
/* }}} */
-
-/* {{{ proto char SessionUpdateTimestampHandler::validateId(string id)
- Simply return TRUE */
-PHP_METHOD(SessionHandler, validateId)
-{
- zend_string *key;
-
- PS_SANITY_CHECK_IS_OPEN;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
- return;
- }
-
- /* Legacy save handler may not support validate_sid API. Return TRUE. */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool SessionUpdateTimestampHandler::updateTimestamp(string id, string data)
- Simply call update_timestamp */
-PHP_METHOD(SessionHandler, updateTimestamp)
-{
- zend_string *key, *val;
-
- PS_SANITY_CHECK_IS_OPEN;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &key, &val) == FAILURE) {
- return;
- }
-
- /* Legacy save handler may not support update_timestamp API. Just write. */
- RETVAL_BOOL(SUCCESS == PS(default_mod)->s_write(&PS(mod_data), key, val, PS(gc_maxlifetime)));
-}
-/* }}} */
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 4c795fdb68..73f8bf31c8 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -249,7 +247,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS);
PHPAPI int php_session_validate_sid(PS_VALIDATE_SID_ARGS);
PHPAPI int php_session_update_timestamp(PS_UPDATE_TIMESTAMP_ARGS);
-PHPAPI void session_adapt_url(const char *, size_t, char **, size_t *);
+PHPAPI void session_adapt_url(const char *url, size_t url_len, char **new_url, size_t *new_len);
PHPAPI int php_session_destroy(void);
PHPAPI void php_add_session_var(zend_string *name);
@@ -262,12 +260,11 @@ PHPAPI int php_session_register_serializer(const char *name,
zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS),
int (*decode)(PS_SERIALIZER_DECODE_ARGS));
-PHPAPI void php_session_set_id(char *id);
PHPAPI int php_session_start(void);
PHPAPI int php_session_flush(int write);
-PHPAPI const ps_module *_php_find_ps_module(char *name);
-PHPAPI const ps_serializer *_php_find_ps_serializer(char *name);
+PHPAPI const ps_module *_php_find_ps_module(const char *name);
+PHPAPI const ps_serializer *_php_find_ps_serializer(const char *name);
PHPAPI int php_session_valid_key(const char *key);
PHPAPI int php_session_reset_id(void);
@@ -327,7 +324,5 @@ extern PHP_METHOD(SessionHandler, write);
extern PHP_METHOD(SessionHandler, destroy);
extern PHP_METHOD(SessionHandler, gc);
extern PHP_METHOD(SessionHandler, create_sid);
-extern PHP_METHOD(SessionHandler, validateId);
-extern PHP_METHOD(SessionHandler, updateTimestamp);
#endif
diff --git a/ext/session/session.c b/ext/session/session.c
index 1efe220c77..658b7daf9b 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -38,6 +36,7 @@
#include "rfc1867.h"
#include "php_variables.h"
#include "php_session.h"
+#include "session_arginfo.h"
#include "ext/standard/php_random.h"
#include "ext/standard/php_var.h"
#include "ext/date/php_date.h"
@@ -71,9 +70,6 @@ zend_class_entry *php_session_iface_entry;
/* SessionIdInterface */
zend_class_entry *php_session_id_iface_entry;
-/* SessionUpdateTimestampHandler class */
-zend_class_entry *php_session_update_timestamp_class_entry;
-
/* SessionUpdateTimestampInterface */
zend_class_entry *php_session_update_timestamp_iface_entry;
@@ -287,7 +283,7 @@ static void bin_to_readable(unsigned char *in, size_t inlen, char *out, size_t o
have += 8;
} else {
/* Should never happen. Input must be large enough. */
- ZEND_ASSERT(0);
+ ZEND_UNREACHABLE();
break;
}
}
@@ -475,8 +471,7 @@ static void php_session_save_current_state(int write) /* {{{ */
if (PS(lazy_write) && PS(session_vars)
&& PS(mod)->s_update_timestamp
&& PS(mod)->s_update_timestamp != php_session_update_timestamp
- && ZSTR_LEN(val) == ZSTR_LEN(PS(session_vars))
- && !memcmp(ZSTR_VAL(val), ZSTR_VAL(PS(session_vars)), ZSTR_LEN(val))
+ && zend_string_equals(val, PS(session_vars))
) {
ret = PS(mod)->s_update_timestamp(&PS(mod_data), PS(id), val, PS(gc_maxlifetime));
} else {
@@ -786,8 +781,7 @@ static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
return SUCCESS;
} /* }}} */
-/* {{{ PHP_INI
- */
+/* {{{ PHP_INI */
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL, OnUpdateSaveDir, save_path, php_ps_globals, ps_globals)
STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateName, session_name, php_ps_globals, ps_globals)
@@ -877,7 +871,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */
Z_ADDREF_P(&PS(http_session_vars));
zend_hash_update_ind(&EG(symbol_table), var_name, &PS(http_session_vars));
zend_string_release_ex(var_name, 0);
- return SUCCESS;
+ return result || !vallen ? SUCCESS : FAILURE;
}
/* }}} */
@@ -994,7 +988,10 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */
while (p < endptr) {
q = p;
while (*q != PS_DELIMITER) {
- if (++q >= endptr) goto break_outer_loop;
+ if (++q >= endptr) {
+ retval = FAILURE;
+ goto break_outer_loop;
+ }
}
namelen = q - p;
@@ -1378,7 +1375,7 @@ static int php_session_send_cookie(void) /* {{{ */
}
/* }}} */
-PHPAPI const ps_module *_php_find_ps_module(char *name) /* {{{ */
+PHPAPI const ps_module *_php_find_ps_module(const char *name) /* {{{ */
{
const ps_module *ret = NULL;
const ps_module **mod;
@@ -1394,7 +1391,7 @@ PHPAPI const ps_module *_php_find_ps_module(char *name) /* {{{ */
}
/* }}} */
-PHPAPI const ps_serializer *_php_find_ps_serializer(char *name) /* {{{ */
+PHPAPI const ps_serializer *_php_find_ps_serializer(const char *name) /* {{{ */
{
const ps_serializer *ret = NULL;
const ps_serializer *mod;
@@ -1652,10 +1649,10 @@ static int php_session_reset(void) /* {{{ */
/* This API is not used by any PHP modules including session currently.
session_adapt_url() may be used to set Session ID to target url without
starting "URL-Rewriter" output handler. */
-PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen) /* {{{ */
+PHPAPI void session_adapt_url(const char *url, size_t url_len, char **new_url, size_t *new_len) /* {{{ */
{
if (APPLY_TRANS_SID && (PS(session_status) == php_session_active)) {
- *new = php_url_scanner_adapt_single_url(url, urllen, PS(session_name), ZSTR_VAL(PS(id)), newlen, 1);
+ *new_url = php_url_scanner_adapt_single_url(url, url_len, PS(session_name), ZSTR_VAL(PS(id)), new_len, 1);
}
}
/* }}} */
@@ -1664,10 +1661,9 @@ PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t
* Userspace exported functions *
******************************** */
-/* {{{ proto bool session_set_cookie_params(int lifetime [, string path [, string domain [, bool secure[, bool httponly]]]])
- session_set_cookie_params(array options)
+/* {{{ session_set_cookie_params(array options)
Set session cookie parameters */
-static PHP_FUNCTION(session_set_cookie_params)
+PHP_FUNCTION(session_set_cookie_params)
{
zval *lifetime_or_options = NULL;
zend_string *lifetime = NULL, *path = NULL, *domain = NULL, *samesite = NULL;
@@ -1824,12 +1820,11 @@ cleanup:
}
/* }}} */
-/* {{{ proto array session_get_cookie_params(void)
- Return the session cookie parameters */
-static PHP_FUNCTION(session_get_cookie_params)
+/* {{{ Return the session cookie parameters */
+PHP_FUNCTION(session_get_cookie_params)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1843,15 +1838,14 @@ static PHP_FUNCTION(session_get_cookie_params)
}
/* }}} */
-/* {{{ proto string session_name([string newname])
- Return the current session name. If newname is given, the session name is replaced with newname */
-static PHP_FUNCTION(session_name)
+/* {{{ Return the current session name. If newname is given, the session name is replaced with newname */
+PHP_FUNCTION(session_name)
{
zend_string *name = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &name) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &name) == FAILURE) {
+ RETURN_THROWS();
}
if (name && PS(session_status) == php_session_active) {
@@ -1874,15 +1868,14 @@ static PHP_FUNCTION(session_name)
}
/* }}} */
-/* {{{ proto string session_module_name([string newname])
- Return the current module name used for accessing session data. If newname is given, the module name is replaced with newname */
-static PHP_FUNCTION(session_module_name)
+/* {{{ Return the current module name used for accessing session data. If newname is given, the module name is replaced with newname */
+PHP_FUNCTION(session_module_name)
{
zend_string *name = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &name) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &name) == FAILURE) {
+ RETURN_THROWS();
}
if (name && PS(session_status) == php_session_active) {
@@ -1921,24 +1914,27 @@ static PHP_FUNCTION(session_module_name)
}
/* }}} */
-/* {{{ proto bool session_set_save_handler(string open, string close, string read, string write, string destroy, string gc, string create_sid)
- Sets user-level functions */
-static PHP_FUNCTION(session_set_save_handler)
-{
- zval *args = NULL;
- int i, num_args, argc = ZEND_NUM_ARGS();
- zend_string *ini_name, *ini_val;
-
+static int save_handler_check_session() {
if (PS(session_status) == php_session_active) {
php_error_docref(NULL, E_WARNING, "Cannot change save handler when session is active");
- RETURN_FALSE;
+ return FAILURE;
}
if (SG(headers_sent)) {
php_error_docref(NULL, E_WARNING, "Cannot change save handler when headers already sent");
- RETURN_FALSE;
+ return FAILURE;
}
+ return SUCCESS;
+}
+
+/* {{{ Sets user-level functions */
+PHP_FUNCTION(session_set_save_handler)
+{
+ zval *args = NULL;
+ int i, num_args, argc = ZEND_NUM_ARGS();
+ zend_string *ini_name, *ini_val;
+
if (argc > 0 && argc <= 2) {
zval *obj = NULL;
zend_string *func_name;
@@ -1946,6 +1942,10 @@ static PHP_FUNCTION(session_set_save_handler)
zend_bool register_shutdown = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &obj, php_session_iface_entry, &register_shutdown) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (save_handler_check_session() == FAILURE) {
RETURN_FALSE;
}
@@ -2048,7 +2048,11 @@ static PHP_FUNCTION(session_set_save_handler)
}
if (zend_parse_parameters(argc, "+", &args, &num_args) == FAILURE) {
- return;
+ RETURN_THROWS();
+ }
+
+ if (save_handler_check_session() == FAILURE) {
+ RETURN_FALSE;
}
/* remove shutdown function */
@@ -2085,15 +2089,14 @@ static PHP_FUNCTION(session_set_save_handler)
}
/* }}} */
-/* {{{ proto string session_save_path([string newname])
- Return the current save path passed to module_name. If newname is given, the save path is replaced with newname */
-static PHP_FUNCTION(session_save_path)
+/* {{{ Return the current save path passed to module_name. If newname is given, the save path is replaced with newname */
+PHP_FUNCTION(session_save_path)
{
zend_string *name = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &name) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|P!", &name) == FAILURE) {
+ RETURN_THROWS();
}
if (name && PS(session_status) == php_session_active) {
@@ -2109,11 +2112,6 @@ static PHP_FUNCTION(session_save_path)
RETVAL_STRING(PS(save_path));
if (name) {
- if (memchr(ZSTR_VAL(name), '\0', ZSTR_LEN(name)) != NULL) {
- php_error_docref(NULL, E_WARNING, "The save_path cannot contain NULL characters");
- zval_ptr_dtor_str(return_value);
- RETURN_FALSE;
- }
ini_name = zend_string_init("session.save_path", sizeof("session.save_path") - 1, 0);
zend_alter_ini_entry(ini_name, name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release_ex(ini_name, 0);
@@ -2121,15 +2119,14 @@ static PHP_FUNCTION(session_save_path)
}
/* }}} */
-/* {{{ proto string session_id([string newid])
- Return the current session id. If newid is given, the session id is replaced with newid */
-static PHP_FUNCTION(session_id)
+/* {{{ Return the current session id. If newid is given, the session id is replaced with newid */
+PHP_FUNCTION(session_id)
{
zend_string *name = NULL;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc, "|S", &name) == FAILURE) {
- return;
+ if (zend_parse_parameters(argc, "|S!", &name) == FAILURE) {
+ RETURN_THROWS();
}
if (name && PS(use_cookies) && SG(headers_sent)) {
@@ -2164,15 +2161,14 @@ static PHP_FUNCTION(session_id)
}
/* }}} */
-/* {{{ proto bool session_regenerate_id([bool delete_old_session])
- Update the current session id with a newly generated one. If delete_old_session is set to true, remove the old session. */
-static PHP_FUNCTION(session_regenerate_id)
+/* {{{ Update the current session id with a newly generated one. If delete_old_session is set to true, remove the old session. */
+PHP_FUNCTION(session_regenerate_id)
{
zend_bool del_ses = 0;
zend_string *data;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &del_ses) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2222,14 +2218,14 @@ static PHP_FUNCTION(session_regenerate_id)
if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) {
PS(session_status) = php_session_none;
zend_throw_error(NULL, "Failed to open session: %s (path: %s)", PS(mod)->s_name, PS(save_path));
- RETURN_FALSE;
+ RETURN_THROWS();
}
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
if (!PS(id)) {
PS(session_status) = php_session_none;
zend_throw_error(NULL, "Failed to create new session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (PS(use_strict_mode) && PS(mod)->s_validate_sid &&
PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == SUCCESS) {
@@ -2239,7 +2235,7 @@ static PHP_FUNCTION(session_regenerate_id)
PS(mod)->s_close(&PS(mod_data));
PS(session_status) = php_session_none;
zend_throw_error(NULL, "Failed to create session ID by collision: %s (path: %s)", PS(mod)->s_name, PS(save_path));
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
/* Read is required to make new session data at this point. */
@@ -2247,7 +2243,7 @@ static PHP_FUNCTION(session_regenerate_id)
PS(mod)->s_close(&PS(mod_data));
PS(session_status) = php_session_none;
zend_throw_error(NULL, "Failed to create(read) session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (data) {
zend_string_release_ex(data, 0);
@@ -2264,16 +2260,15 @@ static PHP_FUNCTION(session_regenerate_id)
}
/* }}} */
-/* {{{ proto string session_create_id([string prefix])
- Generate new session ID. Intended for user save handlers. */
+/* {{{ Generate new session ID. Intended for user save handlers. */
/* This is not used yet */
-static PHP_FUNCTION(session_create_id)
+PHP_FUNCTION(session_create_id)
{
zend_string *prefix = NULL, *new_id;
smart_str id = {0};
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &prefix) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (prefix && ZSTR_LEN(prefix)) {
@@ -2319,15 +2314,14 @@ static PHP_FUNCTION(session_create_id)
}
/* }}} */
-/* {{{ proto string session_cache_limiter([string new_cache_limiter])
- Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */
-static PHP_FUNCTION(session_cache_limiter)
+/* {{{ Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */
+PHP_FUNCTION(session_cache_limiter)
{
zend_string *limiter = NULL;
zend_string *ini_name;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &limiter) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &limiter) == FAILURE) {
+ RETURN_THROWS();
}
if (limiter && PS(session_status) == php_session_active) {
@@ -2350,49 +2344,45 @@ static PHP_FUNCTION(session_cache_limiter)
}
/* }}} */
-/* {{{ proto int session_cache_expire([int new_cache_expire])
- Return the current cache expire. If new_cache_expire is given, the current cache_expire is replaced with new_cache_expire */
-static PHP_FUNCTION(session_cache_expire)
+/* {{{ Return the current cache expire. If new_cache_expire is given, the current cache_expire is replaced with new_cache_expire */
+PHP_FUNCTION(session_cache_expire)
{
- zval *expires = NULL;
- zend_string *ini_name;
+ zend_long expires;
+ zend_bool expires_is_null = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &expires) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &expires, &expires_is_null) == FAILURE) {
+ RETURN_THROWS();
}
- if (expires && PS(session_status) == php_session_active) {
+ if (!expires_is_null && PS(session_status) == php_session_active) {
php_error_docref(NULL, E_WARNING, "Cannot change cache expire when session is active");
RETURN_LONG(PS(cache_expire));
}
- if (expires && SG(headers_sent)) {
+ if (!expires_is_null && SG(headers_sent)) {
php_error_docref(NULL, E_WARNING, "Cannot change cache expire when headers already sent");
RETURN_FALSE;
}
RETVAL_LONG(PS(cache_expire));
- if (expires) {
- if (!try_convert_to_string(expires)) {
- return;
- }
-
- ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
- zend_alter_ini_entry(ini_name, Z_STR_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ if (!expires_is_null) {
+ zend_string *ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
+ zend_string *ini_value = zend_long_to_str(expires);
+ zend_alter_ini_entry(ini_name, ini_value, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
zend_string_release_ex(ini_name, 0);
+ zend_string_release_ex(ini_value, 0);
}
}
/* }}} */
-/* {{{ proto string session_encode(void)
- Serializes the current setup and returns the serialized representation */
-static PHP_FUNCTION(session_encode)
+/* {{{ Serializes the current setup and returns the serialized representation */
+PHP_FUNCTION(session_encode)
{
zend_string *enc;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
enc = php_session_encode();
@@ -2404,14 +2394,13 @@ static PHP_FUNCTION(session_encode)
}
/* }}} */
-/* {{{ proto bool session_decode(string data)
- Deserializes data and reinitializes the variables */
-static PHP_FUNCTION(session_decode)
+/* {{{ Deserializes data and reinitializes the variables */
+PHP_FUNCTION(session_decode)
{
zend_string *str = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2438,9 +2427,8 @@ static int php_session_start_set_ini(zend_string *varname, zend_string *new_valu
return ret;
}
-/* {{{ proto bool session_start([array options])
-+ Begin session */
-static PHP_FUNCTION(session_start)
+/* {{{ + Begin session */
+PHP_FUNCTION(session_start)
{
zval *options = NULL;
zval *value;
@@ -2449,7 +2437,7 @@ static PHP_FUNCTION(session_start)
zend_long read_and_close = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a", &options) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (PS(session_status) == php_session_active) {
@@ -2516,24 +2504,22 @@ static PHP_FUNCTION(session_start)
}
/* }}} */
-/* {{{ proto bool session_destroy(void)
- Destroy the current session and all data associated with it */
-static PHP_FUNCTION(session_destroy)
+/* {{{ Destroy the current session and all data associated with it */
+PHP_FUNCTION(session_destroy)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(php_session_destroy() == SUCCESS);
}
/* }}} */
-/* {{{ proto bool session_unset(void)
- Unset all registered variables */
-static PHP_FUNCTION(session_unset)
+/* {{{ Unset all registered variables */
+PHP_FUNCTION(session_unset)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2551,14 +2537,13 @@ static PHP_FUNCTION(session_unset)
}
/* }}} */
-/* {{{ proto int session_gc(void)
- Perform GC and return number of deleted sessions */
-static PHP_FUNCTION(session_gc)
+/* {{{ Perform GC and return number of deleted sessions */
+PHP_FUNCTION(session_gc)
{
zend_long num;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2576,12 +2561,11 @@ static PHP_FUNCTION(session_gc)
/* }}} */
-/* {{{ proto bool session_write_close(void)
- Write session data and end session */
-static PHP_FUNCTION(session_write_close)
+/* {{{ Write session data and end session */
+PHP_FUNCTION(session_write_close)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2592,12 +2576,11 @@ static PHP_FUNCTION(session_write_close)
}
/* }}} */
-/* {{{ proto bool session_abort(void)
- Abort session and end session. Session data will not be written */
-static PHP_FUNCTION(session_abort)
+/* {{{ Abort session and end session. Session data will not be written */
+PHP_FUNCTION(session_abort)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2608,12 +2591,11 @@ static PHP_FUNCTION(session_abort)
}
/* }}} */
-/* {{{ proto bool session_reset(void)
- Reset session data from saved session data */
-static PHP_FUNCTION(session_reset)
+/* {{{ Reset session data from saved session data */
+PHP_FUNCTION(session_reset)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2624,24 +2606,24 @@ static PHP_FUNCTION(session_reset)
}
/* }}} */
-/* {{{ proto int session_status(void)
- Returns the current session status */
-static PHP_FUNCTION(session_status)
+/* {{{ Returns the current session status */
+PHP_FUNCTION(session_status)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(PS(session_status));
}
/* }}} */
-/* {{{ proto void session_register_shutdown(void)
- Registers session_write_close() as a shutdown function */
-static PHP_FUNCTION(session_register_shutdown)
+/* {{{ Registers session_write_close() as a shutdown function */
+PHP_FUNCTION(session_register_shutdown)
{
php_shutdown_function_entry shutdown_function_entry;
+ ZEND_PARSE_PARAMETERS_NONE();
+
/* This function is registered itself as a shutdown function by
* session_set_save_handler($obj). The reason we now register another
* shutdown function is in case the user registered their own shutdown
@@ -2670,182 +2652,6 @@ static PHP_FUNCTION(session_register_shutdown)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_name, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_module_name, 0, 0, 0)
- ZEND_ARG_INFO(0, module)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_save_path, 0, 0, 0)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_id, 0, 0, 0)
- ZEND_ARG_INFO(0, id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_create_id, 0, 0, 0)
- ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_regenerate_id, 0, 0, 0)
- ZEND_ARG_INFO(0, delete_old_session)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_save_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, open)
- ZEND_ARG_INFO(0, close)
- ZEND_ARG_INFO(0, read)
- ZEND_ARG_INFO(0, write)
- ZEND_ARG_INFO(0, destroy)
- ZEND_ARG_INFO(0, gc)
- ZEND_ARG_INFO(0, create_sid)
- ZEND_ARG_INFO(0, validate_sid)
- ZEND_ARG_INFO(0, update_timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_limiter, 0, 0, 0)
- ZEND_ARG_INFO(0, cache_limiter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_expire, 0, 0, 0)
- ZEND_ARG_INFO(0, new_cache_expire)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_cookie_params, 0, 0, 1)
- ZEND_ARG_INFO(0, lifetime_or_options)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, secure)
- ZEND_ARG_INFO(0, httponly)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_open, 0)
- ZEND_ARG_INFO(0, save_path)
- ZEND_ARG_INFO(0, session_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_close, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_read, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_write, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_destroy, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_gc, 0)
- ZEND_ARG_INFO(0, maxlifetime)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_create_sid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_validateId, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_updateTimestamp, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_start, 0, 0, 0)
- ZEND_ARG_INFO(0, options) /* array */
-ZEND_END_ARG_INFO()
-/* }}} */
-
-/* {{{ session_functions[]
- */
-static const zend_function_entry session_functions[] = {
- PHP_FE(session_name, arginfo_session_name)
- PHP_FE(session_module_name, arginfo_session_module_name)
- PHP_FE(session_save_path, arginfo_session_save_path)
- PHP_FE(session_id, arginfo_session_id)
- PHP_FE(session_create_id, arginfo_session_create_id)
- PHP_FE(session_regenerate_id, arginfo_session_regenerate_id)
- PHP_FE(session_decode, arginfo_session_decode)
- PHP_FE(session_encode, arginfo_session_void)
- PHP_FE(session_start, arginfo_session_start)
- PHP_FE(session_destroy, arginfo_session_void)
- PHP_FE(session_unset, arginfo_session_void)
- PHP_FE(session_gc, arginfo_session_void)
- PHP_FE(session_set_save_handler, arginfo_session_set_save_handler)
- PHP_FE(session_cache_limiter, arginfo_session_cache_limiter)
- PHP_FE(session_cache_expire, arginfo_session_cache_expire)
- PHP_FE(session_set_cookie_params, arginfo_session_set_cookie_params)
- PHP_FE(session_get_cookie_params, arginfo_session_void)
- PHP_FE(session_write_close, arginfo_session_void)
- PHP_FE(session_abort, arginfo_session_void)
- PHP_FE(session_reset, arginfo_session_void)
- PHP_FE(session_status, arginfo_session_void)
- PHP_FE(session_register_shutdown, arginfo_session_void)
- PHP_FALIAS(session_commit, session_write_close, arginfo_session_void)
- PHP_FE_END
-};
-/* }}} */
-
-/* {{{ SessionHandlerInterface functions[]
-*/
-static const zend_function_entry php_session_iface_functions[] = {
- PHP_ABSTRACT_ME(SessionHandlerInterface, open, arginfo_session_class_open)
- PHP_ABSTRACT_ME(SessionHandlerInterface, close, arginfo_session_class_close)
- PHP_ABSTRACT_ME(SessionHandlerInterface, read, arginfo_session_class_read)
- PHP_ABSTRACT_ME(SessionHandlerInterface, write, arginfo_session_class_write)
- PHP_ABSTRACT_ME(SessionHandlerInterface, destroy, arginfo_session_class_destroy)
- PHP_ABSTRACT_ME(SessionHandlerInterface, gc, arginfo_session_class_gc)
- PHP_FE_END
-};
-/* }}} */
-
-/* {{{ SessionIdInterface functions[]
-*/
-static const zend_function_entry php_session_id_iface_functions[] = {
- PHP_ABSTRACT_ME(SessionIdInterface, create_sid, arginfo_session_class_create_sid)
- PHP_FE_END
-};
-/* }}} */
-
-/* {{{ SessionUpdateTimestampHandler functions[]
- */
-static const zend_function_entry php_session_update_timestamp_iface_functions[] = {
- PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, validateId, arginfo_session_class_validateId)
- PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, updateTimestamp, arginfo_session_class_updateTimestamp)
- PHP_FE_END
-};
-/* }}} */
-
-/* {{{ SessionHandler functions[]
- */
-static const zend_function_entry php_session_class_functions[] = {
- PHP_ME(SessionHandler, open, arginfo_session_class_open, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, close, arginfo_session_class_close, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, read, arginfo_session_class_read, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, write, arginfo_session_class_write, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, destroy, arginfo_session_class_destroy, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, gc, arginfo_session_class_gc, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, create_sid, arginfo_session_class_create_sid, ZEND_ACC_PUBLIC)
- PHP_FE_END
-};
-/* }}} */
-
/* ********************************
* Module Setup and Destruction *
******************************** */
@@ -2960,20 +2766,20 @@ static PHP_MINIT_FUNCTION(session) /* {{{ */
php_rfc1867_callback = php_session_rfc1867_callback;
/* Register interfaces */
- INIT_CLASS_ENTRY(ce, PS_IFACE_NAME, php_session_iface_functions);
+ INIT_CLASS_ENTRY(ce, PS_IFACE_NAME, class_SessionHandlerInterface_methods);
php_session_iface_entry = zend_register_internal_class(&ce);
php_session_iface_entry->ce_flags |= ZEND_ACC_INTERFACE;
- INIT_CLASS_ENTRY(ce, PS_SID_IFACE_NAME, php_session_id_iface_functions);
+ INIT_CLASS_ENTRY(ce, PS_SID_IFACE_NAME, class_SessionIdInterface_methods);
php_session_id_iface_entry = zend_register_internal_class(&ce);
php_session_id_iface_entry->ce_flags |= ZEND_ACC_INTERFACE;
- INIT_CLASS_ENTRY(ce, PS_UPDATE_TIMESTAMP_IFACE_NAME, php_session_update_timestamp_iface_functions);
+ INIT_CLASS_ENTRY(ce, PS_UPDATE_TIMESTAMP_IFACE_NAME, class_SessionUpdateTimestampHandlerInterface_methods);
php_session_update_timestamp_iface_entry = zend_register_internal_class(&ce);
php_session_update_timestamp_iface_entry->ce_flags |= ZEND_ACC_INTERFACE;
/* Register base class */
- INIT_CLASS_ENTRY(ce, PS_CLASS_NAME, php_session_class_functions);
+ INIT_CLASS_ENTRY(ce, PS_CLASS_NAME, class_SessionHandler_methods);
php_session_class_entry = zend_register_internal_class(&ce);
zend_class_implements(php_session_class_entry, 1, php_session_iface_entry);
zend_class_implements(php_session_class_entry, 1, php_session_id_iface_entry);
@@ -3001,7 +2807,7 @@ static PHP_MSHUTDOWN_FUNCTION(session) /* {{{ */
}
ps_serializers[PREDEFINED_SERIALIZERS].name = NULL;
- memset(&ps_modules[PREDEFINED_MODULES], 0, (MAX_MODULES-PREDEFINED_MODULES)*sizeof(ps_module *));
+ memset(ZEND_VOIDP(&ps_modules[PREDEFINED_MODULES]), 0, (MAX_MODULES-PREDEFINED_MODULES)*sizeof(ps_module *));
return SUCCESS;
}
@@ -3354,7 +3160,7 @@ zend_module_entry session_module_entry = {
NULL,
session_deps,
"session",
- session_functions,
+ ext_functions,
PHP_MINIT(session), PHP_MSHUTDOWN(session),
PHP_RINIT(session), PHP_RSHUTDOWN(session),
PHP_MINFO(session),
diff --git a/ext/session/session.stub.php b/ext/session/session.stub.php
new file mode 100644
index 0000000000..336a35b731
--- /dev/null
+++ b/ext/session/session.stub.php
@@ -0,0 +1,110 @@
+<?php
+
+/** @generate-function-entries */
+
+function session_name(?string $name = null): string|false {}
+
+function session_module_name(?string $module = null): string|false {}
+
+function session_save_path(?string $path = null): string|false {}
+
+function session_id(?string $id = null): string|false {}
+
+function session_create_id(string $prefix = ""): string|false {}
+
+function session_regenerate_id(bool $delete_old_session = false): bool {}
+
+function session_decode(string $data): bool {}
+
+function session_encode(): string|false {}
+
+function session_destroy(): bool {}
+
+function session_unset(): bool {}
+
+function session_gc(): int|false {}
+
+function session_get_cookie_params(): array {}
+
+function session_write_close(): bool {}
+
+function session_abort(): bool {}
+
+function session_reset(): bool {}
+
+function session_status(): int {}
+
+function session_register_shutdown(): void {}
+
+/** @alias session_write_close */
+function session_commit(): bool {}
+
+function session_set_save_handler($open, $close = UNKNOWN, $read = UNKNOWN, $write = UNKNOWN, $destroy = UNKNOWN, $gc = UNKNOWN, $create_sid = UNKNOWN, $validate_sid = UNKNOWN, $update_timestamp = UNKNOWN): bool {}
+
+function session_cache_limiter(?string $cache_limiter = null): string|false {}
+
+function session_cache_expire(?int $new_cache_expire = null): int|false {}
+
+function session_set_cookie_params($lifetime_or_options, string $path = UNKNOWN, string $domain = "", ?bool $secure = null, ?bool $httponly = null): bool {}
+
+function session_start(array $options = []): bool {}
+
+interface SessionHandlerInterface
+{
+ /** @return bool */
+ public function open(string $save_path, string $session_name);
+
+ /** @return bool */
+ public function close();
+
+ /** @return string */
+ public function read(string $key);
+
+ /** @return bool */
+ public function write(string $key, string $val);
+
+ /** @return bool */
+ public function destroy(string $key);
+
+ /** @return int|bool */
+ public function gc(int $maxlifetime);
+}
+
+interface SessionIdInterface
+{
+ /** @return string */
+ public function create_sid();
+}
+
+interface SessionUpdateTimestampHandlerInterface
+{
+ /** @return bool */
+ public function validateId(string $key);
+
+ /** @return bool */
+ public function updateTimestamp(string $key, string $val);
+}
+
+class SessionHandler implements SessionHandlerInterface, SessionIdInterface
+{
+ /** @return bool */
+ public function open(string $save_path, string $session_name) {}
+
+ /** @return bool */
+ public function close() {}
+
+ /** @return string */
+ public function read(string $key) {}
+
+ /** @return bool */
+ public function write(string $key, string $val) {}
+
+ /** @return bool */
+ public function destroy(string $key) {}
+
+ /** @return int|bool */
+ public function gc(int $maxlifetime) {}
+
+ /** @return string */
+ public function create_sid() {}
+}
diff --git a/ext/session/session_arginfo.h b/ext/session/session_arginfo.h
new file mode 100644
index 0000000000..10556941ac
--- /dev/null
+++ b/ext/session/session_arginfo.h
@@ -0,0 +1,228 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: c026a3449eacd0873d72423483d375d40105e9a0 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_module_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, module, IS_STRING, 1, "null")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_save_path, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, path, IS_STRING, 1, "null")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_id, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, id, IS_STRING, 1, "null")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_create_id, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, prefix, IS_STRING, 0, "\"\"")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_regenerate_id, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, delete_old_session, _IS_BOOL, 0, "false")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_decode, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_encode, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_destroy, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_session_unset arginfo_session_destroy
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_gc, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_get_cookie_params, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_session_write_close arginfo_session_destroy
+
+#define arginfo_session_abort arginfo_session_destroy
+
+#define arginfo_session_reset arginfo_session_destroy
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_status, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_register_shutdown, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_session_commit arginfo_session_destroy
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_set_save_handler, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, open)
+ ZEND_ARG_INFO(0, close)
+ ZEND_ARG_INFO(0, read)
+ ZEND_ARG_INFO(0, write)
+ ZEND_ARG_INFO(0, destroy)
+ ZEND_ARG_INFO(0, gc)
+ ZEND_ARG_INFO(0, create_sid)
+ ZEND_ARG_INFO(0, validate_sid)
+ ZEND_ARG_INFO(0, update_timestamp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_cache_limiter, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_limiter, IS_STRING, 1, "null")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_cache_expire, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, new_cache_expire, IS_LONG, 1, "null")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_set_cookie_params, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, lifetime_or_options)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, domain, IS_STRING, 0, "\"\"")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, secure, _IS_BOOL, 1, "null")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, httponly, _IS_BOOL, 1, "null")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_start, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_open, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, save_path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, session_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_read, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_write, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, val, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SessionHandlerInterface_destroy arginfo_class_SessionHandlerInterface_read
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_gc, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SessionIdInterface_create_sid arginfo_class_SessionHandlerInterface_close
+
+#define arginfo_class_SessionUpdateTimestampHandlerInterface_validateId arginfo_class_SessionHandlerInterface_read
+
+#define arginfo_class_SessionUpdateTimestampHandlerInterface_updateTimestamp arginfo_class_SessionHandlerInterface_write
+
+#define arginfo_class_SessionHandler_open arginfo_class_SessionHandlerInterface_open
+
+#define arginfo_class_SessionHandler_close arginfo_class_SessionHandlerInterface_close
+
+#define arginfo_class_SessionHandler_read arginfo_class_SessionHandlerInterface_read
+
+#define arginfo_class_SessionHandler_write arginfo_class_SessionHandlerInterface_write
+
+#define arginfo_class_SessionHandler_destroy arginfo_class_SessionHandlerInterface_read
+
+#define arginfo_class_SessionHandler_gc arginfo_class_SessionHandlerInterface_gc
+
+#define arginfo_class_SessionHandler_create_sid arginfo_class_SessionHandlerInterface_close
+
+
+ZEND_FUNCTION(session_name);
+ZEND_FUNCTION(session_module_name);
+ZEND_FUNCTION(session_save_path);
+ZEND_FUNCTION(session_id);
+ZEND_FUNCTION(session_create_id);
+ZEND_FUNCTION(session_regenerate_id);
+ZEND_FUNCTION(session_decode);
+ZEND_FUNCTION(session_encode);
+ZEND_FUNCTION(session_destroy);
+ZEND_FUNCTION(session_unset);
+ZEND_FUNCTION(session_gc);
+ZEND_FUNCTION(session_get_cookie_params);
+ZEND_FUNCTION(session_write_close);
+ZEND_FUNCTION(session_abort);
+ZEND_FUNCTION(session_reset);
+ZEND_FUNCTION(session_status);
+ZEND_FUNCTION(session_register_shutdown);
+ZEND_FUNCTION(session_set_save_handler);
+ZEND_FUNCTION(session_cache_limiter);
+ZEND_FUNCTION(session_cache_expire);
+ZEND_FUNCTION(session_set_cookie_params);
+ZEND_FUNCTION(session_start);
+ZEND_METHOD(SessionHandler, open);
+ZEND_METHOD(SessionHandler, close);
+ZEND_METHOD(SessionHandler, read);
+ZEND_METHOD(SessionHandler, write);
+ZEND_METHOD(SessionHandler, destroy);
+ZEND_METHOD(SessionHandler, gc);
+ZEND_METHOD(SessionHandler, create_sid);
+
+
+static const zend_function_entry ext_functions[] = {
+ ZEND_FE(session_name, arginfo_session_name)
+ ZEND_FE(session_module_name, arginfo_session_module_name)
+ ZEND_FE(session_save_path, arginfo_session_save_path)
+ ZEND_FE(session_id, arginfo_session_id)
+ ZEND_FE(session_create_id, arginfo_session_create_id)
+ ZEND_FE(session_regenerate_id, arginfo_session_regenerate_id)
+ ZEND_FE(session_decode, arginfo_session_decode)
+ ZEND_FE(session_encode, arginfo_session_encode)
+ ZEND_FE(session_destroy, arginfo_session_destroy)
+ ZEND_FE(session_unset, arginfo_session_unset)
+ ZEND_FE(session_gc, arginfo_session_gc)
+ ZEND_FE(session_get_cookie_params, arginfo_session_get_cookie_params)
+ ZEND_FE(session_write_close, arginfo_session_write_close)
+ ZEND_FE(session_abort, arginfo_session_abort)
+ ZEND_FE(session_reset, arginfo_session_reset)
+ ZEND_FE(session_status, arginfo_session_status)
+ ZEND_FE(session_register_shutdown, arginfo_session_register_shutdown)
+ ZEND_FALIAS(session_commit, session_write_close, arginfo_session_commit)
+ ZEND_FE(session_set_save_handler, arginfo_session_set_save_handler)
+ ZEND_FE(session_cache_limiter, arginfo_session_cache_limiter)
+ ZEND_FE(session_cache_expire, arginfo_session_cache_expire)
+ ZEND_FE(session_set_cookie_params, arginfo_session_set_cookie_params)
+ ZEND_FE(session_start, arginfo_session_start)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_SessionHandlerInterface_methods[] = {
+ ZEND_ABSTRACT_ME_WITH_FLAGS(SessionHandlerInterface, open, arginfo_class_SessionHandlerInterface_open, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_ABSTRACT_ME_WITH_FLAGS(SessionHandlerInterface, close, arginfo_class_SessionHandlerInterface_close, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_ABSTRACT_ME_WITH_FLAGS(SessionHandlerInterface, read, arginfo_class_SessionHandlerInterface_read, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_ABSTRACT_ME_WITH_FLAGS(SessionHandlerInterface, write, arginfo_class_SessionHandlerInterface_write, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_ABSTRACT_ME_WITH_FLAGS(SessionHandlerInterface, destroy, arginfo_class_SessionHandlerInterface_destroy, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_ABSTRACT_ME_WITH_FLAGS(SessionHandlerInterface, gc, arginfo_class_SessionHandlerInterface_gc, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_SessionIdInterface_methods[] = {
+ ZEND_ABSTRACT_ME_WITH_FLAGS(SessionIdInterface, create_sid, arginfo_class_SessionIdInterface_create_sid, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_SessionUpdateTimestampHandlerInterface_methods[] = {
+ ZEND_ABSTRACT_ME_WITH_FLAGS(SessionUpdateTimestampHandlerInterface, validateId, arginfo_class_SessionUpdateTimestampHandlerInterface_validateId, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_ABSTRACT_ME_WITH_FLAGS(SessionUpdateTimestampHandlerInterface, updateTimestamp, arginfo_class_SessionUpdateTimestampHandlerInterface_updateTimestamp, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_SessionHandler_methods[] = {
+ ZEND_ME(SessionHandler, open, arginfo_class_SessionHandler_open, ZEND_ACC_PUBLIC)
+ ZEND_ME(SessionHandler, close, arginfo_class_SessionHandler_close, ZEND_ACC_PUBLIC)
+ ZEND_ME(SessionHandler, read, arginfo_class_SessionHandler_read, ZEND_ACC_PUBLIC)
+ ZEND_ME(SessionHandler, write, arginfo_class_SessionHandler_write, ZEND_ACC_PUBLIC)
+ ZEND_ME(SessionHandler, destroy, arginfo_class_SessionHandler_destroy, ZEND_ACC_PUBLIC)
+ ZEND_ME(SessionHandler, gc, arginfo_class_SessionHandler_gc, ZEND_ACC_PUBLIC)
+ ZEND_ME(SessionHandler, create_sid, arginfo_class_SessionHandler_create_sid, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
diff --git a/ext/session/tests/001.phpt b/ext/session/tests/001.phpt
index 0643dce51f..adf63c5f6a 100644
--- a/ext/session/tests/001.phpt
+++ b/ext/session/tests/001.phpt
@@ -12,9 +12,9 @@ session.save_handler=files
error_reporting(E_ALL);
class foo {
- public $bar = "ok";
+ public $bar = "ok";
- function method() { $this->yes = "done"; }
+ function method() { $this->yes = "done"; }
}
$baz = new foo;
diff --git a/ext/session/tests/003.phpt b/ext/session/tests/003.phpt
index eae636593d..a20bc9940d 100644
--- a/ext/session/tests/003.phpt
+++ b/ext/session/tests/003.phpt
@@ -13,8 +13,8 @@ session.save_handler=files
error_reporting(E_ALL);
class foo {
- public $bar = "ok";
- function method() { $this->yes++; }
+ public $bar = "ok";
+ function method() { $this->yes++; }
}
session_id("abtest");
diff --git a/ext/session/tests/004.phpt b/ext/session/tests/004.phpt
index 9e34b7123f..4b81a088b2 100644
--- a/ext/session/tests/004.phpt
+++ b/ext/session/tests/004.phpt
@@ -33,7 +33,7 @@ class handler {
function write($key, $val)
{
print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
+ $GLOBALS["hnd"]->data = $val;
return true;
}
diff --git a/ext/session/tests/005.phpt b/ext/session/tests/005.phpt
index 4046b3aebc..a7b42de7fa 100644
--- a/ext/session/tests/005.phpt
+++ b/ext/session/tests/005.phpt
@@ -14,7 +14,7 @@ error_reporting(E_ALL);
ob_start();
class handler {
- public $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
+ public $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
function open($save_path, $session_name)
{
print "OPEN: $session_name\n";
@@ -22,7 +22,7 @@ class handler {
}
function close()
{
- print "CLOSE\n";
+ print "CLOSE\n";
return true;
}
function read($key)
@@ -34,7 +34,7 @@ class handler {
function write($key, $val)
{
print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
+ $GLOBALS["hnd"]->data = $val;
return true;
}
diff --git a/ext/session/tests/017.phpt b/ext/session/tests/017.phpt
index baf7df8c57..957fcb2e45 100644
--- a/ext/session/tests/017.phpt
+++ b/ext/session/tests/017.phpt
@@ -13,10 +13,10 @@ session.save_handler=files
error_reporting(E_ALL);
class Kill {
- function __construct() {
- global $HTTP_SESSION_VARS;
- session_start();
- }
+ function __construct() {
+ global $HTTP_SESSION_VARS;
+ session_start();
+ }
}
$k = new Kill();
diff --git a/ext/session/tests/019.phpt b/ext/session/tests/019.phpt
index 5846291769..d9a478245b 100644
--- a/ext/session/tests/019.phpt
+++ b/ext/session/tests/019.phpt
@@ -14,13 +14,13 @@ session.save_handler=files
error_reporting(E_ALL);
class TFoo {
- public $c;
- function __construct($c) {
- $this->c = $c;
- }
- function inc() {
- $this->c++;
- }
+ public $c;
+ function __construct($c) {
+ $this->c = $c;
+ }
+ function inc() {
+ $this->c++;
+ }
}
session_id("abtest");
diff --git a/ext/session/tests/022.phpt b/ext/session/tests/022.phpt
index 5923bbe0bf..e7e26f88b0 100644
--- a/ext/session/tests/022.phpt
+++ b/ext/session/tests/022.phpt
@@ -12,9 +12,9 @@ session.save_handler=files
error_reporting(E_ALL);
class foo {
- public $bar = "ok";
+ public $bar = "ok";
- function method() { $this->yes = "done"; }
+ function method() { $this->yes = "done"; }
}
$baz = new foo;
diff --git a/ext/session/tests/023.phpt b/ext/session/tests/023.phpt
index 592b4a8c3b..828358dc78 100644
--- a/ext/session/tests/023.phpt
+++ b/ext/session/tests/023.phpt
@@ -13,8 +13,8 @@ session.save_handler=files
error_reporting(E_ALL);
class foo {
- public $bar = "ok";
- function method() { $this->yes++; }
+ public $bar = "ok";
+ function method() { $this->yes++; }
}
session_id("abtest");
diff --git a/ext/session/tests/024.phpt b/ext/session/tests/024.phpt
index d417a82ca1..174f2e2639 100644
--- a/ext/session/tests/024.phpt
+++ b/ext/session/tests/024.phpt
@@ -34,7 +34,7 @@ class handler {
function write($key, $val)
{
print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
+ $GLOBALS["hnd"]->data = $val;
return true;
}
diff --git a/ext/session/tests/025.phpt b/ext/session/tests/025.phpt
index aa1f995c49..172ea579c6 100644
--- a/ext/session/tests/025.phpt
+++ b/ext/session/tests/025.phpt
@@ -23,7 +23,7 @@ class handler {
}
function close()
{
- print "CLOSE\n";
+ print "CLOSE\n";
return true;
}
function read($key)
diff --git a/ext/session/tests/bug31454.phpt b/ext/session/tests/bug31454.phpt
index 24da588aa4..9e99135e5f 100644
--- a/ext/session/tests/bug31454.phpt
+++ b/ext/session/tests/bug31454.phpt
@@ -6,12 +6,12 @@ Bug #31454 (session_set_save_handler crashes PHP when supplied non-existent obje
<?php
session_set_save_handler(
- array(&$arf, 'open'),
- array(&$arf, 'close'),
- array(&$arf, 'read'),
- array(&$arf, 'write'),
- array(&$arf, 'destroy'),
- array(&$arf, 'gc'));
+ array(&$arf, 'open'),
+ array(&$arf, 'close'),
+ array(&$arf, 'read'),
+ array(&$arf, 'write'),
+ array(&$arf, 'destroy'),
+ array(&$arf, 'gc'));
echo "Done\n";
?>
diff --git a/ext/session/tests/bug32330.phpt b/ext/session/tests/bug32330.phpt
index 1c7713dbfb..9d567a1f62 100644
--- a/ext/session/tests/bug32330.phpt
+++ b/ext/session/tests/bug32330.phpt
@@ -16,38 +16,38 @@ error_reporting(E_ALL);
function sOpen($path, $name)
{
- echo "open: path = {$path}, name = {$name}\n";
- return TRUE;
+ echo "open: path = {$path}, name = {$name}\n";
+ return TRUE;
}
function sClose()
{
- echo "close\n";
- return TRUE;
+ echo "close\n";
+ return TRUE;
}
function sRead($id)
{
- echo "read: id = {$id}\n";
- return '';
+ echo "read: id = {$id}\n";
+ return '';
}
function sWrite($id, $data)
{
- echo "write: id = {$id}, data = {$data}\n";
- return TRUE;
+ echo "write: id = {$id}, data = {$data}\n";
+ return TRUE;
}
function sDestroy($id)
{
- echo "destroy: id = {$id}\n";
- return TRUE;
+ echo "destroy: id = {$id}\n";
+ return TRUE;
}
function sGC($maxlifetime)
{
- echo "gc: maxlifetime = {$maxlifetime}\n";
- return TRUE;
+ echo "gc: maxlifetime = {$maxlifetime}\n";
+ return TRUE;
}
session_set_save_handler( 'sOpen', 'sClose', 'sRead', 'sWrite', 'sDestroy', 'sGC' );
diff --git a/ext/session/tests/bug60634.phpt b/ext/session/tests/bug60634.phpt
index 064f29a0d2..09e64ad4bf 100644
--- a/ext/session/tests/bug60634.phpt
+++ b/ext/session/tests/bug60634.phpt
@@ -16,15 +16,15 @@ function open($save_path, $session_name) {
}
function close() {
- die("close: goodbye cruel world\n");
+ die("close: goodbye cruel world\n");
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- die("write: goodbye cruel world\n");
+ die("write: goodbye cruel world\n");
}
function destroy($id) {
@@ -40,20 +40,6 @@ session_start();
session_write_close();
echo "um, hi\n";
-/*
- * write() calls die(). This results in calling session_flush() which calls
- * write() in request shutdown. The code is inside save handler still and
- * calls save close handler.
- *
- * Because session_write_close() fails by die(), write() is called twice.
- * close() is still called at request shutdown since session is active.
- */
-
?>
--EXPECT--
write: goodbye cruel world
-
-Warning: Unknown: Cannot call session save handler in a recursive manner in Unknown on line 0
-
-Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path: ) in Unknown on line 0
-close: goodbye cruel world
diff --git a/ext/session/tests/bug60634_error_1.phpt b/ext/session/tests/bug60634_error_1.phpt
index c573b65e36..9a1d2288a3 100644
--- a/ext/session/tests/bug60634_error_1.phpt
+++ b/ext/session/tests/bug60634_error_1.phpt
@@ -16,17 +16,17 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- return true;
+ echo "close: goodbye cruel world\n";
+ return true;
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- echo "write: goodbye cruel world\n";
- undefined_function();
+ echo "write: goodbye cruel world\n";
+ undefined_function();
}
function destroy($id) {
diff --git a/ext/session/tests/bug60634_error_2.phpt b/ext/session/tests/bug60634_error_2.phpt
index 4ca598b4e7..ef06095692 100644
--- a/ext/session/tests/bug60634_error_2.phpt
+++ b/ext/session/tests/bug60634_error_2.phpt
@@ -16,17 +16,17 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- return true;
+ echo "close: goodbye cruel world\n";
+ return true;
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- echo "write: goodbye cruel world\n";
- throw new Exception;
+ echo "write: goodbye cruel world\n";
+ throw new Exception;
}
function destroy($id) {
diff --git a/ext/session/tests/bug60634_error_3.phpt b/ext/session/tests/bug60634_error_3.phpt
index f97da00dce..1909fc8ada 100644
--- a/ext/session/tests/bug60634_error_3.phpt
+++ b/ext/session/tests/bug60634_error_3.phpt
@@ -16,17 +16,17 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- exit;
+ echo "close: goodbye cruel world\n";
+ exit;
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- echo "write: goodbye cruel world\n";
- undefined_function();
+ echo "write: goodbye cruel world\n";
+ undefined_function();
}
function destroy($id) {
diff --git a/ext/session/tests/bug60634_error_4.phpt b/ext/session/tests/bug60634_error_4.phpt
index ca8672e4f4..e3834f262c 100644
--- a/ext/session/tests/bug60634_error_4.phpt
+++ b/ext/session/tests/bug60634_error_4.phpt
@@ -16,17 +16,17 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- exit;
+ echo "close: goodbye cruel world\n";
+ exit;
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- echo "write: goodbye cruel world\n";
- throw new Exception;
+ echo "write: goodbye cruel world\n";
+ throw new Exception;
}
function destroy($id) {
diff --git a/ext/session/tests/bug60634_error_5.phpt b/ext/session/tests/bug60634_error_5.phpt
index 5728d3a90c..333c86c67f 100644
--- a/ext/session/tests/bug60634_error_5.phpt
+++ b/ext/session/tests/bug60634_error_5.phpt
@@ -16,16 +16,16 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- undefined_function();
+ echo "close: goodbye cruel world\n";
+ undefined_function();
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- return true;
+ return true;
}
function destroy($id) {
diff --git a/ext/session/tests/bug71162.phpt b/ext/session/tests/bug71162.phpt
index 31d3370499..b475ae6080 100644
--- a/ext/session/tests/bug71162.phpt
+++ b/ext/session/tests/bug71162.phpt
@@ -36,13 +36,13 @@ class MySessionHandler extends SessionHandler implements SessionUpdateTimestampH
return TRUE;
}
- public function create_sid() {
- return sha1(random_bytes(32));
- }
+ public function create_sid() {
+ return sha1(random_bytes(32));
+ }
- public function validateId($sid) {
- return TRUE;
- }
+ public function validateId($sid) {
+ return TRUE;
+ }
public function updateTimestamp($sessid, $sessdata) {
echo __FUNCTION__, PHP_EOL;
diff --git a/ext/session/tests/bug71972.phpt b/ext/session/tests/bug71972.phpt
index e4c5c6b6d3..1384cae21e 100644
--- a/ext/session/tests/bug71972.phpt
+++ b/ext/session/tests/bug71972.phpt
@@ -13,13 +13,13 @@ $_SESSION['boogie'] = 1;
$_SESSION['obj1'] = new stdClass();
for ( $x=2; $x < 20; $x++) {
- cyclic_ref($x);
+ cyclic_ref($x);
}
function cyclic_ref($num) {
- $_SESSION['obj'.$num] = new stdClass();
- $_SESSION['obj'.$num]->test = new stdClass();//NOTE: No bug if try commenting out this too.
- $_SESSION['obj'.$num]->obj1 = $_SESSION['obj1'];
+ $_SESSION['obj'.$num] = new stdClass();
+ $_SESSION['obj'.$num]->test = new stdClass();//NOTE: No bug if try commenting out this too.
+ $_SESSION['obj'.$num]->obj1 = $_SESSION['obj1'];
}
var_dump(session_decode(session_encode()) == $_SESSION);
diff --git a/ext/session/tests/bug72562.phpt b/ext/session/tests/bug72562.phpt
index b36cf6df25..8421e8940a 100644
--- a/ext/session/tests/bug72562.phpt
+++ b/ext/session/tests/bug72562.phpt
@@ -27,12 +27,12 @@ var_dump($out_2);
function ptr2str($ptr)
{
- $out = '';
- for ($i = 0; $i < 8; $i++) {
- $out .= chr($ptr & 0xff);
- $ptr >>= 8;
- }
- return $out;
+ $out = '';
+ for ($i = 0; $i < 8; $i++) {
+ $out .= chr($ptr & 0xff);
+ $ptr >>= 8;
+ }
+ return $out;
}
?>
--EXPECTF--
diff --git a/ext/session/tests/bug73529.phpt b/ext/session/tests/bug73529.phpt
index a14c63bc7f..7fc4fa6d38 100644
--- a/ext/session/tests/bug73529.phpt
+++ b/ext/session/tests/bug73529.phpt
@@ -1,16 +1,15 @@
--TEST--
Bug #73529 session_decode() silently fails on wrong input
---XFAIL--
-session_decode() does not return proper status.
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
+ob_start();
ini_set("session.serialize_handler", "php_serialize");
session_start();
-$result1 = session_decode(serialize(["foo" => "bar"]));
+$result1 = session_decode('foo|s:3:"bar";');
$session1 = $_SESSION;
session_destroy();
@@ -21,17 +20,24 @@ $result2 = session_decode(serialize(["foo" => "bar"]));
$session2 = $_SESSION;
session_destroy();
+echo ob_get_clean();
+
var_dump($result1);
var_dump($session1);
var_dump($result2);
var_dump($session2);
?>
---EXPECT--
-bool(true)
-array(1) {
- ["foo"]=>
- string(3) "bar"
+--EXPECTF--
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
+array(0) {
}
bool(false)
array(0) {
diff --git a/ext/session/tests/bug74514.phpt b/ext/session/tests/bug74514.phpt
index f7c8d46998..5ff86c1bfb 100644
--- a/ext/session/tests/bug74514.phpt
+++ b/ext/session/tests/bug74514.phpt
@@ -23,7 +23,6 @@ var_dump(session_save_path());
var_dump(session_cache_limiter());
var_dump(session_cache_expire());
?>
-===DONE===
--EXPECT--
string(9) "PHPSESSID"
string(3) "foo"
@@ -31,4 +30,3 @@ string(5) "files"
string(0) ""
string(7) "nocache"
int(180)
-===DONE===
diff --git a/ext/session/tests/bug74541.phpt b/ext/session/tests/bug74541.phpt
index dec2f25b5d..ccdfdbffde 100644
--- a/ext/session/tests/bug74541.phpt
+++ b/ext/session/tests/bug74541.phpt
@@ -10,8 +10,6 @@ $r = new ReflectionFunction('session_start');
var_dump($r->getNumberOfParameters());
var_dump($r->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(1)
int(0)
-===DONE===
diff --git a/ext/session/tests/bug74833.phpt b/ext/session/tests/bug74833.phpt
index fa167a1f3a..d299f4ee96 100644
--- a/ext/session/tests/bug74833.phpt
+++ b/ext/session/tests/bug74833.phpt
@@ -15,7 +15,5 @@ var_dump(isset($c['session']['SID']));
ob_end_flush();
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/session/tests/bug74892.phpt b/ext/session/tests/bug74892.phpt
index 0947df7761..3b11ec20a7 100644
--- a/ext/session/tests/bug74892.phpt
+++ b/ext/session/tests/bug74892.phpt
@@ -16,10 +16,8 @@ session_start();
<p><a href="index.php#place">External link with anchor</a></p>
<p><a href="http://php.net#foo">External link with anchor 2</a></p>
<p><a href="#place">Internal link</a></p>
-===DONE===
--EXPECT--
<p><a href="index.php?PHPSESSID=sessionidhere">Click This Anchor Tag!</a></p>
<p><a href="index.php?PHPSESSID=sessionidhere#place">External link with anchor</a></p>
<p><a href="http://php.net?PHPSESSID=sessionidhere#foo">External link with anchor 2</a></p>
<p><a href="#place">Internal link</a></p>
-===DONE===
diff --git a/ext/session/tests/bug74936.phpt b/ext/session/tests/bug74936.phpt
index aee7493c6c..7b502c85b5 100644
--- a/ext/session/tests/bug74936.phpt
+++ b/ext/session/tests/bug74936.phpt
@@ -12,9 +12,7 @@ var_dump(session_cache_expire());
var_dump(session_cache_limiter());
var_dump(session_save_path());
?>
-===DONE===
--EXPECT--
int(180)
string(7) "nocache"
string(0) ""
-===DONE===
diff --git a/ext/session/tests/bug74941.phpt b/ext/session/tests/bug74941.phpt
index 953d642b10..59b57e1b4d 100644
--- a/ext/session/tests/bug74941.phpt
+++ b/ext/session/tests/bug74941.phpt
@@ -15,8 +15,6 @@ echo ".\n";
session_id('BUG74941');
var_dump(session_start());
?>
-===DONE===
--EXPECT--
.
bool(true)
-===DONE===
diff --git a/ext/session/tests/bug78624.phpt b/ext/session/tests/bug78624.phpt
index e9274809d0..6db6945eb4 100644
--- a/ext/session/tests/bug78624.phpt
+++ b/ext/session/tests/bug78624.phpt
@@ -11,12 +11,6 @@ session.gc_probability=0
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Test session_set_save_handler() : session_gc() returns the number of deleted records. ***\n";
class MySession implements SessionHandlerInterface {
diff --git a/ext/session/tests/bug79221.phpt b/ext/session/tests/bug79221.phpt
index b0972c4697..0813457035 100644
--- a/ext/session/tests/bug79221.phpt
+++ b/ext/session/tests/bug79221.phpt
@@ -40,6 +40,6 @@ session_start();
var_dump($_SESSION);
session_destroy();
---EXPECTF--
+--EXPECT--
array(0) {
}
diff --git a/ext/session/tests/save_handler_closures.inc b/ext/session/tests/save_handler_closures.inc
index 50f33c1098..acf72f00f6 100644
--- a/ext/session/tests/save_handler_closures.inc
+++ b/ext/session/tests/save_handler_closures.inc
@@ -3,7 +3,7 @@
require_once 'save_handler.inc';
foreach (array ('open', 'close', 'read', 'write', 'destroy', 'gc') as $fn) {
- ${$fn.'_closure'} = function () use ($fn) { return call_user_func_array ($fn, func_get_args ()); };
+ ${$fn.'_closure'} = function () use ($fn) { return call_user_func_array ($fn, func_get_args ()); };
}
?>
diff --git a/ext/session/tests/session_abort_basic.phpt b/ext/session/tests/session_abort_basic.phpt
index b5a12ae4c1..95a5044d16 100644
--- a/ext/session/tests/session_abort_basic.phpt
+++ b/ext/session/tests/session_abort_basic.phpt
@@ -11,12 +11,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : void session_abort(void)
- * Description : Should abort session. Session data should not be written.
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_abort() : basic functionality ***\n";
session_start();
diff --git a/ext/session/tests/session_basic1.phpt b/ext/session/tests/session_basic1.phpt
index 658c8e7287..ffdcf6c5ec 100644
--- a/ext/session/tests/session_basic1.phpt
+++ b/ext/session/tests/session_basic1.phpt
@@ -15,12 +15,6 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : session.use_strict_mode=0
- * Description : Test basic functionality.
- * Source code : ext/session/session.c, ext/session/mod_files.c
- */
-
echo "*** Testing basic session functionality : variation1 ***\n";
$session_id = 'testid';
diff --git a/ext/session/tests/session_basic2.phpt b/ext/session/tests/session_basic2.phpt
index 30ac946c1e..cb9585303c 100644
--- a/ext/session/tests/session_basic2.phpt
+++ b/ext/session/tests/session_basic2.phpt
@@ -17,12 +17,6 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : session.use_strict_mode=1
- * Description : Test basic functionality.
- * Source code : ext/session/session.c, ext/session/mod_files.c
- */
-
echo "*** Testing basic session functionality : variation2 ***\n";
$session_id = 'testid';
diff --git a/ext/session/tests/session_basic3.phpt b/ext/session/tests/session_basic3.phpt
index 29bda63edb..f6ed10e296 100644
--- a/ext/session/tests/session_basic3.phpt
+++ b/ext/session/tests/session_basic3.phpt
@@ -20,12 +20,6 @@ url_rewriter.hosts=
ob_start();
-/*
- * Prototype : session.use_trans_sid=1
- * Description : Test basic functionality.
- * Source code : ext/session/session.c
- */
-
echo "*** Testing basic session functionality : variation3 use_trans_sid ***\n";
/*
diff --git a/ext/session/tests/session_basic4.phpt b/ext/session/tests/session_basic4.phpt
index 32525640e8..2f9b914462 100644
--- a/ext/session/tests/session_basic4.phpt
+++ b/ext/session/tests/session_basic4.phpt
@@ -21,12 +21,6 @@ url_rewriter.tags="a=href,area=href,frame=src,form="
ob_start();
-/*
- * Prototype : session.use_trans_sid=1
- * Description : Test basic functionality.
- * Source code : ext/session/session.c
- */
-
echo "*** Testing basic session functionality : variation4 use_trans_sid ***\n";
echo "*** Test trans sid ***\n";
diff --git a/ext/session/tests/session_basic5.phpt b/ext/session/tests/session_basic5.phpt
index 351c69b41d..50e6cde920 100644
--- a/ext/session/tests/session_basic5.phpt
+++ b/ext/session/tests/session_basic5.phpt
@@ -21,12 +21,6 @@ ob_start();
$_SERVER['HTTP_HOST'] = 'php.net';
ini_set('session.trans_sid_hosts','php.net,example.com');
-/*
- * Prototype : session.use_trans_sid=1
- * Description : Test basic functionality.
- * Source code : ext/session/session.c
- */
-
echo "*** Testing basic session functionality : variation5 use_trans_sid ***\n";
echo "*** Test trans sid ***\n";
diff --git a/ext/session/tests/session_cache_expire_basic.phpt b/ext/session/tests/session_cache_expire_basic.phpt
index 871e32a317..d2ffe64e92 100644
--- a/ext/session/tests/session_cache_expire_basic.phpt
+++ b/ext/session/tests/session_cache_expire_basic.phpt
@@ -7,12 +7,6 @@ Test session_cache_expire() function : basic functionality
ob_start();
-/*
- * Prototype : int session_cache_expire([int $new_cache_expire])
- * Description : Return current cache expire
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_cache_expire() : basic functionality ***\n";
var_dump(session_cache_expire());
diff --git a/ext/session/tests/session_cache_expire_error.phpt b/ext/session/tests/session_cache_expire_error.phpt
deleted file mode 100644
index 5ae5d95637..0000000000
--- a/ext/session/tests/session_cache_expire_error.phpt
+++ /dev/null
@@ -1,169 +0,0 @@
---TEST--
-Test session_cache_expire() function : error functionality
---SKIPIF--
-<?php include('skipif.inc'); ?>
---FILE--
-<?php
-
-ob_start();
-
-/*
- * Prototype : int session_cache_expire([int $new_cache_expire])
- * Description : Return current cache expire
- * Source code : ext/session/session.c
- */
-
-echo "*** Testing session_cache_expire() : error functionality ***\n";
-
-// Get an unset variable
-$unset_var = 10;
-unset($unset_var);
-
-class classA
-{
- public function __toString() {
- return "Hello World!";
- }
-}
-
-$heredoc = <<<EOT
-Hello World!
-EOT;
-
-$fp = fopen(__FILE__, "r");
-
-// Unexpected values to be passed as arguments
-$inputs = array(
-
- // Integer data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // Float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // Null data
-/*10*/ NULL,
- null,
-
- // Boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // Empty strings
-/*16*/ "",
- '',
-
- // Invalid string data
-/*18*/ "Nothing",
- 'Nothing',
- $heredoc,
-
- // Object data
-/*21*/ new classA(),
-
- // Undefined data
-/*22*/ @$undefined_var,
-
- // Unset data
-/*23*/ @$unset_var,
-
- // Resource variable
-/*24*/ $fp
-);
-
-
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(session_cache_expire($input));
- $iterator++;
-};
-
-fclose($fp);
-echo "Done";
-ob_end_flush();
-?>
---EXPECTF--
-*** Testing session_cache_expire() : error functionality ***
-
--- Iteration 1 --
-int(180)
-
--- Iteration 2 --
-int(0)
-
--- Iteration 3 --
-int(1)
-
--- Iteration 4 --
-int(12345)
-
--- Iteration 5 --
-int(-2345)
-
--- Iteration 6 --
-int(10)
-
--- Iteration 7 --
-int(-10)
-
--- Iteration 8 --
-int(%s)
-
--- Iteration 9 --
-int(1)
-
--- Iteration 10 --
-int(0)
-
--- Iteration 11 --
-int(0)
-
--- Iteration 12 --
-int(0)
-
--- Iteration 13 --
-int(1)
-
--- Iteration 14 --
-int(0)
-
--- Iteration 15 --
-int(1)
-
--- Iteration 16 --
-int(0)
-
--- Iteration 17 --
-int(0)
-
--- Iteration 18 --
-int(0)
-
--- Iteration 19 --
-int(0)
-
--- Iteration 20 --
-int(0)
-
--- Iteration 21 --
-int(0)
-
--- Iteration 22 --
-int(0)
-
--- Iteration 23 --
-int(0)
-
--- Iteration 24 --
-int(0)
-Done
diff --git a/ext/session/tests/session_cache_expire_variation1.phpt b/ext/session/tests/session_cache_expire_variation1.phpt
index 1c6e5922b4..dd0bd40b83 100644
--- a/ext/session/tests/session_cache_expire_variation1.phpt
+++ b/ext/session/tests/session_cache_expire_variation1.phpt
@@ -9,12 +9,6 @@ session.cache_expire=360
ob_start();
-/*
- * Prototype : int session_cache_expire([int $new_cache_expire])
- * Description : Return current cache expire
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_cache_expire() : variation ***\n";
var_dump(session_cache_expire());
diff --git a/ext/session/tests/session_cache_expire_variation2.phpt b/ext/session/tests/session_cache_expire_variation2.phpt
index b712266e80..83f76f150a 100644
--- a/ext/session/tests/session_cache_expire_variation2.phpt
+++ b/ext/session/tests/session_cache_expire_variation2.phpt
@@ -7,12 +7,6 @@ Test session_cache_expire() function : variation
ob_start();
-/*
- * Prototype : int session_cache_expire([int $new_cache_expire])
- * Description : Return current cache expire
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_cache_expire() : variation ***\n";
ini_set("session.cache_expire", 360);
diff --git a/ext/session/tests/session_cache_expire_variation3.phpt b/ext/session/tests/session_cache_expire_variation3.phpt
index 492816f276..ab5a05a292 100644
--- a/ext/session/tests/session_cache_expire_variation3.phpt
+++ b/ext/session/tests/session_cache_expire_variation3.phpt
@@ -7,12 +7,6 @@ Test session_cache_expire() function : variation
ob_start();
-/*
- * Prototype : int session_cache_expire([int $new_cache_expire])
- * Description : Return current cache expire
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_cache_expire() : variation ***\n";
var_dump(ini_get("session.cache_expire"));
diff --git a/ext/session/tests/session_cache_limiter_basic.phpt b/ext/session/tests/session_cache_limiter_basic.phpt
index 39b5fcd5f1..57493ee0aa 100644
--- a/ext/session/tests/session_cache_limiter_basic.phpt
+++ b/ext/session/tests/session_cache_limiter_basic.phpt
@@ -7,12 +7,6 @@ Test session_cache_limiter() function : basic functionality
ob_start();
-/*
- * Prototype : string session_cache_limiter([string $cache_limiter])
- * Description : Get and/or set the current cache limiter
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_cache_limiter() : basic functionality ***\n";
var_dump(session_cache_limiter());
diff --git a/ext/session/tests/session_cache_limiter_error.phpt b/ext/session/tests/session_cache_limiter_error.phpt
deleted file mode 100644
index 42b2cb0694..0000000000
--- a/ext/session/tests/session_cache_limiter_error.phpt
+++ /dev/null
@@ -1,171 +0,0 @@
---TEST--
-Test session_cache_limiter() function : error functionality
---SKIPIF--
-<?php include('skipif.inc'); ?>
---FILE--
-<?php
-
-ob_start();
-
-/*
- * Prototype : string session_cache_limiter([string $cache_limiter])
- * Description : Get and/or set the current cache limiter
- * Source code : ext/session/session.c
- */
-
-echo "*** Testing session_cache_limiter() : error functionality ***\n";
-
-// Get an unset variable
-$unset_var = 10;
-unset($unset_var);
-
-class classA
-{
- public function __toString() {
- return "Hello World!";
- }
-}
-
-$heredoc = <<<EOT
-Hello World!
-EOT;
-
-$fp = fopen(__FILE__, "r");
-
-// Unexpected values to be passed as arguments
-$inputs = array(
-
- // Integer data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // Float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // Null data
-/*10*/ NULL,
- null,
-
- // Boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // Empty strings
-/*16*/ "",
- '',
-
- // Invalid string data
-/*18*/ "Nothing",
- 'Nothing',
- $heredoc,
-
- // Object data
-/*21*/ new classA(),
-
- // Undefined data
-/*22*/ @$undefined_var,
-
- // Unset data
-/*23*/ @$unset_var,
-
- // Resource variable
-/*24*/ $fp
-);
-
-
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(session_cache_limiter($input));
- $iterator++;
-};
-
-fclose($fp);
-echo "Done";
-ob_end_flush();
-?>
---EXPECTF--
-*** Testing session_cache_limiter() : error functionality ***
-
--- Iteration 1 --
-string(7) "nocache"
-
--- Iteration 2 --
-string(1) "0"
-
--- Iteration 3 --
-string(1) "1"
-
--- Iteration 4 --
-string(5) "12345"
-
--- Iteration 5 --
-string(5) "-2345"
-
--- Iteration 6 --
-string(4) "10.5"
-
--- Iteration 7 --
-string(5) "-10.5"
-
--- Iteration 8 --
-string(12) "123456789000"
-
--- Iteration 9 --
-string(13) "1.23456789E-9"
-
--- Iteration 10 --
-string(3) "0.5"
-
--- Iteration 11 --
-string(0) ""
-
--- Iteration 12 --
-string(0) ""
-
--- Iteration 13 --
-string(1) "1"
-
--- Iteration 14 --
-string(0) ""
-
--- Iteration 15 --
-string(1) "1"
-
--- Iteration 16 --
-string(0) ""
-
--- Iteration 17 --
-string(0) ""
-
--- Iteration 18 --
-string(0) ""
-
--- Iteration 19 --
-string(7) "Nothing"
-
--- Iteration 20 --
-string(7) "Nothing"
-
--- Iteration 21 --
-string(12) "Hello World!"
-
--- Iteration 22 --
-string(12) "Hello World!"
-
--- Iteration 23 --
-string(0) ""
-
--- Iteration 24 --
-
-Warning: session_cache_limiter() expects parameter 1 to be string, resource given in %s on line %d
-NULL
-Done
diff --git a/ext/session/tests/session_cache_limiter_variation1.phpt b/ext/session/tests/session_cache_limiter_variation1.phpt
index ce9b011d26..1ef15d7ff5 100644
--- a/ext/session/tests/session_cache_limiter_variation1.phpt
+++ b/ext/session/tests/session_cache_limiter_variation1.phpt
@@ -9,12 +9,6 @@ session.cache_limiter=nocache
ob_start();
-/*
- * Prototype : string session_cache_limiter([string $cache_limiter])
- * Description : Get and/or set the current cache limiter
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_cache_limiter() : variation ***\n";
var_dump(session_cache_limiter());
@@ -34,7 +28,7 @@ string(7) "nocache"
bool(true)
string(7) "nocache"
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line 16
+Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line %d
bool(false)
string(7) "nocache"
bool(true)
diff --git a/ext/session/tests/session_cache_limiter_variation2.phpt b/ext/session/tests/session_cache_limiter_variation2.phpt
index 58dc5da6c4..695f63ebca 100644
--- a/ext/session/tests/session_cache_limiter_variation2.phpt
+++ b/ext/session/tests/session_cache_limiter_variation2.phpt
@@ -7,12 +7,6 @@ Test session_cache_limiter() function : variation
ob_start();
-/*
- * Prototype : string session_cache_limiter([string $cache_limiter])
- * Description : Get and/or set the current cache limiter
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_cache_limiter() : variation ***\n";
ini_set("session.cache_limiter", "nocache");
@@ -33,7 +27,7 @@ string(7) "nocache"
bool(true)
string(7) "nocache"
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line 17
+Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line %d
bool(false)
string(7) "nocache"
bool(true)
diff --git a/ext/session/tests/session_cache_limiter_variation3.phpt b/ext/session/tests/session_cache_limiter_variation3.phpt
index a55648a851..f37af43936 100644
--- a/ext/session/tests/session_cache_limiter_variation3.phpt
+++ b/ext/session/tests/session_cache_limiter_variation3.phpt
@@ -7,12 +7,6 @@ Test session_cache_limiter() function : variation
ob_start();
-/*
- * Prototype : string session_cache_limiter([string $cache_limiter])
- * Description : Get and/or set the current cache limiter
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_cache_limiter() : variation ***\n";
var_dump(ini_get("session.cache_limiter"));
@@ -32,7 +26,7 @@ string(7) "nocache"
bool(true)
string(7) "nocache"
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line 16
+Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line %d
bool(false)
string(7) "nocache"
bool(true)
diff --git a/ext/session/tests/session_commit_basic.phpt b/ext/session/tests/session_commit_basic.phpt
index 473be005f9..c0e9011c87 100644
--- a/ext/session/tests/session_commit_basic.phpt
+++ b/ext/session/tests/session_commit_basic.phpt
@@ -7,12 +7,6 @@ Test session_commit() function : basic functionality
ob_start();
-/*
- * Prototype : bool session_commit(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_commit() : basic functionality ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_commit_variation1.phpt b/ext/session/tests/session_commit_variation1.phpt
index cce0756d62..0773ca663d 100644
--- a/ext/session/tests/session_commit_variation1.phpt
+++ b/ext/session/tests/session_commit_variation1.phpt
@@ -7,12 +7,6 @@ Test session_commit() function : variation
ob_start();
-/*
- * Prototype : bool session_commit(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_commit() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_commit_variation2.phpt b/ext/session/tests/session_commit_variation2.phpt
index 9de2fc12f7..d05a8b6e28 100644
--- a/ext/session/tests/session_commit_variation2.phpt
+++ b/ext/session/tests/session_commit_variation2.phpt
@@ -7,12 +7,6 @@ Test session_commit() function : variation
ob_start();
-/*
- * Prototype : bool session_commit(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_commit() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_commit_variation3.phpt b/ext/session/tests/session_commit_variation3.phpt
index 38f7f885d3..58d7a56c8b 100644
--- a/ext/session/tests/session_commit_variation3.phpt
+++ b/ext/session/tests/session_commit_variation3.phpt
@@ -9,12 +9,6 @@ session.auto_start=1
ob_start();
-/*
- * Prototype : bool session_commit(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_commit() : variation ***\n";
var_dump($_SESSION);
diff --git a/ext/session/tests/session_commit_variation4.phpt b/ext/session/tests/session_commit_variation4.phpt
index 6c91e6578a..2633f543af 100644
--- a/ext/session/tests/session_commit_variation4.phpt
+++ b/ext/session/tests/session_commit_variation4.phpt
@@ -9,12 +9,6 @@ session.use_strict_mode=0
ob_start();
-/*
- * Prototype : bool session_commit(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_commit() : variation ***\n";
var_dump(ini_get('session.use_strict_mode'));
diff --git a/ext/session/tests/session_commit_variation5.phpt b/ext/session/tests/session_commit_variation5.phpt
index cc7f6f333e..778bc72b91 100644
--- a/ext/session/tests/session_commit_variation5.phpt
+++ b/ext/session/tests/session_commit_variation5.phpt
@@ -9,12 +9,6 @@ session.use_strict_mode=0
ob_start();
-/*
- * Prototype : bool session_commit(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_commit() : variation ***\n";
$id = md5(uniqid());
diff --git a/ext/session/tests/session_create_id_basic.phpt b/ext/session/tests/session_create_id_basic.phpt
index 4f5cc3e41e..6b6f21372f 100644
--- a/ext/session/tests/session_create_id_basic.phpt
+++ b/ext/session/tests/session_create_id_basic.phpt
@@ -10,12 +10,6 @@ session.sid_length=32
ob_start();
-/*
- * Prototype : string session_create_id([string $prefix])
- * Description : Create new session ID with prefix optionally.
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_create_id() : basic functionality ***\n";
// No session
diff --git a/ext/session/tests/session_decode_basic.phpt b/ext/session/tests/session_decode_basic.phpt
index 2c61583117..60354e0024 100644
--- a/ext/session/tests/session_decode_basic.phpt
+++ b/ext/session/tests/session_decode_basic.phpt
@@ -7,12 +7,6 @@ Test session_decode() function : basic functionality
ob_start();
-/*
- * Prototype : string session_decode(void)
- * Description : Decodes session data from a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_decode() : basic functionality ***\n";
// Get an unset variable
diff --git a/ext/session/tests/session_decode_basic_serialize.phpt b/ext/session/tests/session_decode_basic_serialize.phpt
index 43c30b9d58..12f0f20570 100644
--- a/ext/session/tests/session_decode_basic_serialize.phpt
+++ b/ext/session/tests/session_decode_basic_serialize.phpt
@@ -7,12 +7,6 @@ Test session_decode() function : basic functionality
ob_start();
-/*
- * Prototype : string session_decode(void)
- * Description : Decodes session data from a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_decode() : basic functionality ***\n";
// Get an unset variable
diff --git a/ext/session/tests/session_decode_error2.phpt b/ext/session/tests/session_decode_error2.phpt
index ff4e618a5e..7379e8078b 100644
--- a/ext/session/tests/session_decode_error2.phpt
+++ b/ext/session/tests/session_decode_error2.phpt
@@ -7,18 +7,12 @@ Test session_decode() function : error functionality
ob_start();
-/*
- * Prototype : string session_decode(void)
- * Description : Decodes session data from a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_decode() : error functionality ***\n";
$data = "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;";
var_dump(session_start());
for($index = 0; $index < strlen($data); $index++) {
- if(session_status() != PHP_SESSION_ACTIVE) { session_start(); }
+ if(session_status() != PHP_SESSION_ACTIVE) { session_start(); }
echo "\n-- Iteration $index --\n";
$encoded = substr($data, 0, $index);
var_dump(session_decode($encoded));
@@ -39,226 +33,232 @@ array(0) {
}
-- Iteration 1 --
-bool(true)
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
array(0) {
}
-- Iteration 2 --
-bool(true)
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
array(0) {
}
-- Iteration 3 --
-bool(true)
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
array(0) {
}
-- Iteration 4 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 5 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 6 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 7 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 8 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 9 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 10 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 11 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 12 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 13 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 14 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 15 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 16 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 17 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 18 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 19 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 20 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 21 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 22 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 23 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 24 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 25 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 26 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 27 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 28 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 29 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 30 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 31 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 32 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 33 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
@@ -278,85 +278,57 @@ array(1) {
}
-- Iteration 35 --
-bool(true)
-array(1) {
- ["foo"]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
+array(0) {
}
-- Iteration 36 --
-bool(true)
-array(1) {
- ["foo"]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
+array(0) {
}
-- Iteration 37 --
-bool(true)
-array(1) {
- ["foo"]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
+array(0) {
}
-- Iteration 38 --
-bool(true)
-array(1) {
- ["foo"]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
+array(0) {
}
-- Iteration 39 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 40 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 41 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 42 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
@@ -385,125 +357,61 @@ array(2) {
}
-- Iteration 44 --
-bool(true)
-array(2) {
- ["foo"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- ["guff"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
+array(0) {
}
-- Iteration 45 --
-bool(true)
-array(2) {
- ["foo"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- ["guff"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
+array(0) {
}
-- Iteration 46 --
-bool(true)
-array(2) {
- ["foo"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- ["guff"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
+array(0) {
}
-- Iteration 47 --
-bool(true)
-array(2) {
- ["foo"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- ["guff"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
+array(0) {
}
-- Iteration 48 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 49 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 50 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-- Iteration 51 --
-Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%esession_decode_error2.php on line %d
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
bool(false)
array(0) {
}
-Warning: session_destroy(): Trying to destroy uninitialized session in %s%esession_decode_error2.php on line %d
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
bool(false)
Done
diff --git a/ext/session/tests/session_decode_variation1.phpt b/ext/session/tests/session_decode_variation1.phpt
index 70c8ada5bc..0996e2f2c9 100644
--- a/ext/session/tests/session_decode_variation1.phpt
+++ b/ext/session/tests/session_decode_variation1.phpt
@@ -7,12 +7,6 @@ Test session_decode() function : variation
ob_start();
-/*
- * Prototype : string session_decode(void)
- * Description : Decodes session data from a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_decode() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_decode_variation2.phpt b/ext/session/tests/session_decode_variation2.phpt
index 6b3a7325fc..185716e15a 100644
--- a/ext/session/tests/session_decode_variation2.phpt
+++ b/ext/session/tests/session_decode_variation2.phpt
@@ -7,12 +7,6 @@ Test session_decode() function : basic functionality
ob_start();
-/*
- * Prototype : string session_decode(void)
- * Description : Decodes session data from a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_decode() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_decode_variation3.phpt b/ext/session/tests/session_decode_variation3.phpt
index a50feb0cf0..9494edd339 100644
--- a/ext/session/tests/session_decode_variation3.phpt
+++ b/ext/session/tests/session_decode_variation3.phpt
@@ -9,12 +9,6 @@ session.serialize_handler=blah
ob_start();
-/*
- * Prototype : string session_decode(void)
- * Description : Decodes session data from a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_decode() : variation ***\n";
var_dump(session_start());
@@ -37,7 +31,7 @@ ob_end_flush();
Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d
bool(false)
-Notice: Undefined variable: _SESSION in %s on line %d
+Warning: Undefined variable $_SESSION in %s on line %d
NULL
array(3) {
["foo"]=>
diff --git a/ext/session/tests/session_decode_variation4.phpt b/ext/session/tests/session_decode_variation4.phpt
index f239a86ab9..efaf6793d9 100644
--- a/ext/session/tests/session_decode_variation4.phpt
+++ b/ext/session/tests/session_decode_variation4.phpt
@@ -7,12 +7,6 @@ Test session_decode() function : variation
ob_start();
-/*
- * Prototype : string session_decode(void)
- * Description : Decodes session data from a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_decode() : variation ***\n";
var_dump(session_start());
@@ -29,7 +23,7 @@ var_dump(session_destroy());
echo "Done";
ob_end_flush();
?>
---EXPECT--
+--EXPECTF--
*** Testing session_decode() : variation ***
bool(true)
array(0) {
@@ -42,14 +36,12 @@ array(3) {
["guff"]=>
float(123.456)
}
-bool(true)
-array(3) {
- ["foo"]=>
- int(1234567890)
- ["bar"]=>
- string(5) "Blah!"
- ["guff"]=>
- float(123.456)
+
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+bool(false)
+array(0) {
}
-bool(true)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
Done
diff --git a/ext/session/tests/session_destroy_variation1.phpt b/ext/session/tests/session_destroy_variation1.phpt
index 2863ba63b3..e2b8febcab 100644
--- a/ext/session/tests/session_destroy_variation1.phpt
+++ b/ext/session/tests/session_destroy_variation1.phpt
@@ -7,12 +7,6 @@ Test session_destroy() function : variation
ob_start();
-/*
- * Prototype : bool session_destroy(void)
- * Description : Destroys all data registered to a session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_destroy() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_destroy_variation2.phpt b/ext/session/tests/session_destroy_variation2.phpt
index 9e0913c9af..896d78ac71 100644
--- a/ext/session/tests/session_destroy_variation2.phpt
+++ b/ext/session/tests/session_destroy_variation2.phpt
@@ -7,12 +7,6 @@ Test session_destroy() function : variation
ob_start();
-/*
- * Prototype : bool session_destroy(void)
- * Description : Destroys all data registered to a session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_destroy() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_destroy_variation3.phpt b/ext/session/tests/session_destroy_variation3.phpt
index 2f8a37aa8a..5d00466da3 100644
--- a/ext/session/tests/session_destroy_variation3.phpt
+++ b/ext/session/tests/session_destroy_variation3.phpt
@@ -7,12 +7,6 @@ Test session_destroy() function : variation
ob_start();
-/*
- * Prototype : bool session_destroy(void)
- * Description : Destroys all data registered to a session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_destroy() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_encode_basic.phpt b/ext/session/tests/session_encode_basic.phpt
index d0f37a3b29..b8d8db3a41 100644
--- a/ext/session/tests/session_encode_basic.phpt
+++ b/ext/session/tests/session_encode_basic.phpt
@@ -9,12 +9,6 @@ serialize_precision=100
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : basic functionality ***\n";
// Get an unset variable
diff --git a/ext/session/tests/session_encode_error2.phpt b/ext/session/tests/session_encode_error2.phpt
index 1a87eb14a3..9cca3ffea4 100644
--- a/ext/session/tests/session_encode_error2.phpt
+++ b/ext/session/tests/session_encode_error2.phpt
@@ -7,12 +7,6 @@ Test session_encode() function : error functionality
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : error functionality ***\n";
// Get an unset variable
@@ -84,7 +78,11 @@ $iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
var_dump(session_start());
- $_SESSION[$input] = "Hello World!";
+ try {
+ $_SESSION[$input] = "Hello World!";
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump(session_encode());
var_dump(session_destroy());
$iterator++;
@@ -225,8 +223,7 @@ bool(true)
-- Iteration 21 --
bool(true)
-
-Warning: Illegal offset type in %s on line 82
+Illegal offset type
bool(false)
bool(true)
@@ -243,7 +240,7 @@ bool(true)
-- Iteration 24 --
bool(true)
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Notice: session_encode(): Skipping numeric key %d in %s on line %d
bool(false)
diff --git a/ext/session/tests/session_encode_variation1.phpt b/ext/session/tests/session_encode_variation1.phpt
index cff175c1d1..a0d883b7a5 100644
--- a/ext/session/tests/session_encode_variation1.phpt
+++ b/ext/session/tests/session_encode_variation1.phpt
@@ -7,12 +7,6 @@ Test session_encode() function : variation
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : variation ***\n";
var_dump(session_encode());
diff --git a/ext/session/tests/session_encode_variation2.phpt b/ext/session/tests/session_encode_variation2.phpt
index a6d7331784..b13366b3fa 100644
--- a/ext/session/tests/session_encode_variation2.phpt
+++ b/ext/session/tests/session_encode_variation2.phpt
@@ -9,12 +9,6 @@ session.auto_start=1
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : variation ***\n";
var_dump(session_encode());
diff --git a/ext/session/tests/session_encode_variation3.phpt b/ext/session/tests/session_encode_variation3.phpt
index c85a9b120d..4d30b879e3 100644
--- a/ext/session/tests/session_encode_variation3.phpt
+++ b/ext/session/tests/session_encode_variation3.phpt
@@ -7,12 +7,6 @@ Test session_encode() function : variation
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_encode_variation4.phpt b/ext/session/tests/session_encode_variation4.phpt
index 4d03f92ad5..613a3ba101 100644
--- a/ext/session/tests/session_encode_variation4.phpt
+++ b/ext/session/tests/session_encode_variation4.phpt
@@ -7,12 +7,6 @@ Test session_encode() function : variation
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_encode_variation5.phpt b/ext/session/tests/session_encode_variation5.phpt
index c923ab4059..e35666ef21 100644
--- a/ext/session/tests/session_encode_variation5.phpt
+++ b/ext/session/tests/session_encode_variation5.phpt
@@ -7,12 +7,6 @@ Test session_encode() function : variation
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_encode_variation6.phpt b/ext/session/tests/session_encode_variation6.phpt
index 4c3f0370fa..b334842fea 100644
--- a/ext/session/tests/session_encode_variation6.phpt
+++ b/ext/session/tests/session_encode_variation6.phpt
@@ -7,12 +7,6 @@ Test session_encode() function : variation
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_encode_variation7.phpt b/ext/session/tests/session_encode_variation7.phpt
index 85e9aa50b8..a79ca8be82 100644
--- a/ext/session/tests/session_encode_variation7.phpt
+++ b/ext/session/tests/session_encode_variation7.phpt
@@ -9,12 +9,6 @@ session.serialize_handler=php_binary
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_encode_variation8.phpt b/ext/session/tests/session_encode_variation8.phpt
index c84152cd13..2ffa79335b 100644
--- a/ext/session/tests/session_encode_variation8.phpt
+++ b/ext/session/tests/session_encode_variation8.phpt
@@ -9,12 +9,6 @@ session.serialize_handler=blah
ob_start();
-/*
- * Prototype : string session_encode(void)
- * Description : Encodes the current session data as a string
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_encode() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_gc_basic.phpt b/ext/session/tests/session_gc_basic.phpt
index 483134061e..b98c7e43e1 100644
--- a/ext/session/tests/session_gc_basic.phpt
+++ b/ext/session/tests/session_gc_basic.phpt
@@ -7,12 +7,6 @@ Test session_gc() function : basic functionality
ob_start();
-/*
- * Prototype : int session_gc(void)
- * Description : Perform GC
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_gc() : basic functionality ***\n";
var_dump(session_gc());
diff --git a/ext/session/tests/session_get_cookie_params_basic.phpt b/ext/session/tests/session_get_cookie_params_basic.phpt
index cd41ce85ef..fa4692e532 100644
--- a/ext/session/tests/session_get_cookie_params_basic.phpt
+++ b/ext/session/tests/session_get_cookie_params_basic.phpt
@@ -14,12 +14,6 @@ session.cookie_samesite=""
ob_start();
-/*
- * Prototype : array session_get_cookie_params(void)
- * Description : Get the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_get_cookie_params() : basic functionality ***\n";
var_dump(session_get_cookie_params());
diff --git a/ext/session/tests/session_get_cookie_params_variation1.phpt b/ext/session/tests/session_get_cookie_params_variation1.phpt
index 13dc94442c..9fdb676f8b 100644
--- a/ext/session/tests/session_get_cookie_params_variation1.phpt
+++ b/ext/session/tests/session_get_cookie_params_variation1.phpt
@@ -14,12 +14,6 @@ session.cookie_samesite=""
ob_start();
-/*
- * Prototype : array session_get_cookie_params(void)
- * Description : Get the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_get_cookie_params() : variation ***\n";
var_dump(session_get_cookie_params());
diff --git a/ext/session/tests/session_id_basic.phpt b/ext/session/tests/session_id_basic.phpt
index 487b5d7a37..9d2bab5d83 100644
--- a/ext/session/tests/session_id_basic.phpt
+++ b/ext/session/tests/session_id_basic.phpt
@@ -7,12 +7,6 @@ Test session_id() function : basic functionality
ob_start();
-/*
- * Prototype : string session_id([string $id])
- * Description : Get and/or set the current session id
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_id() : basic functionality ***\n";
var_dump(session_id());
diff --git a/ext/session/tests/session_id_basic2.phpt b/ext/session/tests/session_id_basic2.phpt
index 7a19696e61..9bd09056fa 100644
--- a/ext/session/tests/session_id_basic2.phpt
+++ b/ext/session/tests/session_id_basic2.phpt
@@ -7,12 +7,6 @@ Test session_id() function : basic functionality
ob_start();
-/*
- * Prototype : string session_id([string $id])
- * Description : Get and/or set the current session id
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_id() : basic functionality ***\n";
ini_set('session.sid_bits_per_chracter', 6);
diff --git a/ext/session/tests/session_id_error2.phpt b/ext/session/tests/session_id_error2.phpt
index 0d256564b6..c017d73d6b 100644
--- a/ext/session/tests/session_id_error2.phpt
+++ b/ext/session/tests/session_id_error2.phpt
@@ -7,12 +7,6 @@ Test session_id() function : error functionality
ob_start();
-/*
- * Prototype : string session_id([string $id])
- * Description : Get and/or set the current session id
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_id() : error functionality ***\n";
var_dump(session_id("test"));
diff --git a/ext/session/tests/session_id_error3.phpt b/ext/session/tests/session_id_error3.phpt
index 12fe5c2814..eb22485cec 100644
--- a/ext/session/tests/session_id_error3.phpt
+++ b/ext/session/tests/session_id_error3.phpt
@@ -7,12 +7,6 @@ Test session_id() function : error functionality
ob_start();
-/*
- * Prototype : string session_id([string $id])
- * Description : Get and/or set the current session id
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_id() : error functionality ***\n";
var_dump(session_id());
diff --git a/ext/session/tests/session_module_name_basic.phpt b/ext/session/tests/session_module_name_basic.phpt
index 8d8bf70573..c0cda1b930 100644
--- a/ext/session/tests/session_module_name_basic.phpt
+++ b/ext/session/tests/session_module_name_basic.phpt
@@ -7,12 +7,6 @@ Test session_module_name() function : basic functionality
ob_start();
-/*
- * Prototype : string session_module_name([string $module])
- * Description : Get and/or set the current session module
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_module_name() : basic functionality ***\n";
var_dump(session_module_name("files"));
var_dump(session_module_name());
diff --git a/ext/session/tests/session_module_name_variation1.phpt b/ext/session/tests/session_module_name_variation1.phpt
index 59d9112a55..05c972fb91 100644
--- a/ext/session/tests/session_module_name_variation1.phpt
+++ b/ext/session/tests/session_module_name_variation1.phpt
@@ -7,12 +7,6 @@ Test session_module_name() function : variation
ob_start();
-/*
- * Prototype : string session_module_name([string $module])
- * Description : Get and/or set the current session module
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_module_name() : variation ***\n";
var_dump(session_module_name("blah"));
var_dump(session_start());
diff --git a/ext/session/tests/session_module_name_variation2.phpt b/ext/session/tests/session_module_name_variation2.phpt
index b14c0c2aac..f499279654 100644
--- a/ext/session/tests/session_module_name_variation2.phpt
+++ b/ext/session/tests/session_module_name_variation2.phpt
@@ -7,12 +7,6 @@ Test session_module_name() function : variation
ob_start();
-/*
- * Prototype : string session_module_name([string $module])
- * Description : Get and/or set the current session module
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_module_name() : variation ***\n";
function open($save_path, $session_name) { }
diff --git a/ext/session/tests/session_module_name_variation3.phpt b/ext/session/tests/session_module_name_variation3.phpt
index b03173cecf..481229eebc 100644
--- a/ext/session/tests/session_module_name_variation3.phpt
+++ b/ext/session/tests/session_module_name_variation3.phpt
@@ -11,12 +11,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : string session_module_name([string $module])
- * Description : Get and/or set the current session module
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_module_name() : variation ***\n";
function open($save_path, $session_name) {
throw new Exception("Stop...!");
@@ -42,11 +36,11 @@ ob_end_flush();
string(5) "files"
string(4) "user"
-Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line 25
+Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d
-Fatal error: Uncaught Exception: Stop...! in %s:13
+Fatal error: Uncaught Exception: Stop...! in %s:%d
Stack trace:
#0 [internal function]: open('', 'PHPSESSID')
-#1 %s(25): session_start()
+#1 %s(%d): session_start()
#2 {main}
- thrown in %s on line 13
+ thrown in %s on line %d
diff --git a/ext/session/tests/session_module_name_variation4.phpt b/ext/session/tests/session_module_name_variation4.phpt
index 303a5f8939..2b12bce70a 100644
--- a/ext/session/tests/session_module_name_variation4.phpt
+++ b/ext/session/tests/session_module_name_variation4.phpt
@@ -11,12 +11,6 @@ session.gc_maxlifetime=0
ob_start();
-/*
- * Prototype : string session_module_name([string $module])
- * Description : Get and/or set the current session module
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_module_name() : variation ***\n";
require_once "save_handler.inc";
diff --git a/ext/session/tests/session_name_basic.phpt b/ext/session/tests/session_name_basic.phpt
index 5fb435b2bf..f987ab66d6 100644
--- a/ext/session/tests/session_name_basic.phpt
+++ b/ext/session/tests/session_name_basic.phpt
@@ -11,12 +11,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : string session_name([string $name])
- * Description : Get and/or set the current session name
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_name() : error functionality ***\n";
var_dump(session_name());
diff --git a/ext/session/tests/session_name_variation1.phpt b/ext/session/tests/session_name_variation1.phpt
index 82e5278783..35db378ea5 100644
--- a/ext/session/tests/session_name_variation1.phpt
+++ b/ext/session/tests/session_name_variation1.phpt
@@ -11,12 +11,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : string session_name([string $name])
- * Description : Get and/or set the current session name
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_name() : variation ***\n";
var_dump(session_name("\0"));
diff --git a/ext/session/tests/session_name_variation2.phpt b/ext/session/tests/session_name_variation2.phpt
index 3111ceb00f..15a816633e 100644
--- a/ext/session/tests/session_name_variation2.phpt
+++ b/ext/session/tests/session_name_variation2.phpt
@@ -9,12 +9,6 @@ session.name=blah
ob_start();
-/*
- * Prototype : string session_name([string $name])
- * Description : Get and/or set the current session name
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_name() : variation ***\n";
var_dump(session_name());
diff --git a/ext/session/tests/session_regenerate_id_basic.phpt b/ext/session/tests/session_regenerate_id_basic.phpt
index 49a7e301d4..8d221ef006 100644
--- a/ext/session/tests/session_regenerate_id_basic.phpt
+++ b/ext/session/tests/session_regenerate_id_basic.phpt
@@ -7,12 +7,6 @@ Test session_regenerate_id() function : basic functionality
ob_start();
-/*
- * Prototype : bool session_regenerate_id([bool $delete_old_session])
- * Description : Update the current session id with a newly generated one
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_regenerate_id() : basic functionality ***\n";
var_dump(session_id());
diff --git a/ext/session/tests/session_regenerate_id_cookie.phpt b/ext/session/tests/session_regenerate_id_cookie.phpt
index c3c5464860..acaba5addf 100644
--- a/ext/session/tests/session_regenerate_id_cookie.phpt
+++ b/ext/session/tests/session_regenerate_id_cookie.phpt
@@ -13,12 +13,6 @@ get_cgi_path() or die('skip no cgi');
--FILE--
<?php
-/*
- * Prototype : bool session_regenerate_id([bool $delete_old_session])
- * Description : Update the current session id with a newly generated one
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_regenerate_id() : basic functionality for cookie ***\n";
require __DIR__.'/../../../sapi/cgi/tests/include.inc';
@@ -32,16 +26,16 @@ file_put_contents($file, '<?php
ob_start();
function find_cookie_header() {
- $headers = headers_list();
- $target = "Set-Cookie: PHPSESSID=";
- foreach ($headers as $h) {
- if (strstr($h, $target) !== FALSE) {
- echo $h."\n";
- return TRUE;
- }
- }
- var_dump($headers);
- return FALSE;
+ $headers = headers_list();
+ $target = "Set-Cookie: PHPSESSID=";
+ foreach ($headers as $h) {
+ if (strstr($h, $target) !== FALSE) {
+ echo $h."\n";
+ return TRUE;
+ }
+ }
+ var_dump($headers);
+ return FALSE;
}
var_dump(session_start());
@@ -64,7 +58,7 @@ echo "Done";
?>
--EXPECTF--
*** Testing session_regenerate_id() : basic functionality for cookie ***
-string(%d) "X-Powered-By: PHP/7.%s
+string(%d) "X-Powered-By: PHP/%d.%d.%s
Expires: %s
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
diff --git a/ext/session/tests/session_regenerate_id_variation1.phpt b/ext/session/tests/session_regenerate_id_variation1.phpt
index 484a7d001b..1967cff018 100644
--- a/ext/session/tests/session_regenerate_id_variation1.phpt
+++ b/ext/session/tests/session_regenerate_id_variation1.phpt
@@ -7,12 +7,6 @@ Test session_regenerate_id() function : variation
ob_start();
-/*
- * Prototype : bool session_regenerate_id([bool $delete_old_session])
- * Description : Update the current session id with a newly generated one
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_regenerate_id() : variation ***\n";
var_dump(session_id());
diff --git a/ext/session/tests/session_reset_basic.phpt b/ext/session/tests/session_reset_basic.phpt
index a2ddc7af34..7ba84ff34c 100644
--- a/ext/session/tests/session_reset_basic.phpt
+++ b/ext/session/tests/session_reset_basic.phpt
@@ -11,12 +11,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : void session_reset(void)
- * Description : Should abort session. Session data should not be written.
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_abort() : basic functionality ***\n";
session_start();
diff --git a/ext/session/tests/session_save_path_basic.phpt b/ext/session/tests/session_save_path_basic.phpt
index 15027631cc..db578cb6b1 100644
--- a/ext/session/tests/session_save_path_basic.phpt
+++ b/ext/session/tests/session_save_path_basic.phpt
@@ -11,12 +11,6 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : string session_save_path([string $path])
- * Description : Get and/or set the current session save path
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_save_path() : error functionality ***\n";
$directory = __DIR__;
diff --git a/ext/session/tests/session_save_path_variation1.phpt b/ext/session/tests/session_save_path_variation1.phpt
index 20ed9301ce..8475b2d2e4 100644
--- a/ext/session/tests/session_save_path_variation1.phpt
+++ b/ext/session/tests/session_save_path_variation1.phpt
@@ -12,12 +12,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : string session_save_path([string $path])
- * Description : Get and/or set the current session save path
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_save_path() : variation ***\n";
$directory = __DIR__;
@@ -44,7 +38,7 @@ string(%d) "%stests"
bool(true)
string(%d) "%stests"
-Warning: session_save_path(): Cannot change save path when session is active in %s on line 20
+Warning: session_save_path(): Cannot change save path when session is active in %s on line %d
bool(false)
string(%d) "%stests"
bool(true)
diff --git a/ext/session/tests/session_save_path_variation2.phpt b/ext/session/tests/session_save_path_variation2.phpt
index b8fb86509f..d857cdf6a5 100644
--- a/ext/session/tests/session_save_path_variation2.phpt
+++ b/ext/session/tests/session_save_path_variation2.phpt
@@ -10,12 +10,6 @@ session.gc_probability=0
ob_start();
-/*
- * Prototype : string session_save_path([string $path])
- * Description : Get and/or set the current session save path
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_save_path() : variation ***\n";
ini_set("session.save_path", "/blah");
diff --git a/ext/session/tests/session_save_path_variation3.phpt b/ext/session/tests/session_save_path_variation3.phpt
index e369b12e0a..966e0d893c 100644
--- a/ext/session/tests/session_save_path_variation3.phpt
+++ b/ext/session/tests/session_save_path_variation3.phpt
@@ -10,12 +10,6 @@ session.gc_probability=0
ob_start();
-/*
- * Prototype : string session_save_path([string $path])
- * Description : Get and/or set the current session save path
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_save_path() : variation ***\n";
ini_set("session.save_path", "/blah");
diff --git a/ext/session/tests/session_save_path_variation4.phpt b/ext/session/tests/session_save_path_variation4.phpt
index 1cb86e1c30..8b3df52262 100644
--- a/ext/session/tests/session_save_path_variation4.phpt
+++ b/ext/session/tests/session_save_path_variation4.phpt
@@ -12,12 +12,6 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : string session_save_path([string $path])
- * Description : Get and/or set the current session save path
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_save_path() : variation ***\n";
$initdir = __DIR__;
$sessions = ($initdir."/sessions");
@@ -26,7 +20,7 @@ chdir($initdir);
// Delete the existing directory
if (file_exists($sessions) === TRUE) {
- @rmdir($sessions);
+ @rmdir($sessions);
}
var_dump(mkdir($sessions));
@@ -42,25 +36,26 @@ echo "Done";
ob_end_flush();
?>
--CLEAN--
+<?php
$initdir = __DIR__;
$sessions = ($initdir."/sessions");
-chdir($initdir);
var_dump(rmdir($sessions));
+?>
--EXPECTF--
*** Testing session_save_path() : variation ***
bool(true)
bool(true)
-Warning: ini_set(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line 24
+Warning: ini_set(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d
string(0) ""
-Warning: session_start(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line 26
+Warning: session_start(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d
-Warning: session_start(): Failed to initialize storage module: files (path: ) in %s on line 26
+Warning: session_start(): Failed to initialize storage module: files (path: ) in %s on line %d
bool(false)
string(0) ""
-Warning: session_destroy(): Trying to destroy uninitialized session in %s on line 28
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
bool(false)
string(0) ""
Done
diff --git a/ext/session/tests/session_save_path_variation5.phpt b/ext/session/tests/session_save_path_variation5.phpt
index 557634c903..5388f82f45 100644
--- a/ext/session/tests/session_save_path_variation5.phpt
+++ b/ext/session/tests/session_save_path_variation5.phpt
@@ -13,12 +13,6 @@ session.name=PHPSESSID
<?php
ob_start();
-/*
- * Prototype : string session_save_path([string $path])
- * Description : Get and/or set the current session save path
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_save_path() : variation ***\n";
$directory = __DIR__;
$sessions = ($directory."/sessions");
@@ -27,7 +21,7 @@ chdir($directory);
ini_set('open_basedir', '.');
// Delete the existing directory
if (file_exists($sessions) === TRUE) {
- @rmdir($sessions);
+ @rmdir($sessions);
}
var_dump(mkdir($sessions));
@@ -40,9 +34,11 @@ echo "Done";
ob_end_flush();
?>
--CLEAN--
+<?php
$directory = __DIR__;
$sessions = ($directory."/sessions");
var_dump(rmdir($sessions));
+?>
--EXPECTF--
*** Testing session_save_path() : variation ***
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_basic.phpt b/ext/session/tests/session_set_cookie_params_basic.phpt
index e40c4e77b7..79bf7a9ea9 100644
--- a/ext/session/tests/session_set_cookie_params_basic.phpt
+++ b/ext/session/tests/session_set_cookie_params_basic.phpt
@@ -7,12 +7,6 @@ Test session_set_cookie_params() function : basic functionality
ob_start();
-/*
- * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
- * Description : Set the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_cookie_params() : basic functionality ***\n";
var_dump(session_set_cookie_params(3600));
@@ -29,7 +23,7 @@ ob_end_flush();
bool(true)
bool(true)
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line 15
+Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
bool(false)
bool(true)
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation1.phpt b/ext/session/tests/session_set_cookie_params_variation1.phpt
index 46ec780e9d..bad85d3aaf 100644
--- a/ext/session/tests/session_set_cookie_params_variation1.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation1.phpt
@@ -9,12 +9,6 @@ session.cookie_lifetime=3600
ob_start();
-/*
- * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
- * Description : Set the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_cookie_params() : variation ***\n";
var_dump(ini_get("session.cookie_lifetime"));
@@ -42,7 +36,7 @@ string(4) "3600"
bool(true)
string(4) "3600"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line 19
+Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
bool(false)
string(4) "3600"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation2.phpt b/ext/session/tests/session_set_cookie_params_variation2.phpt
index 07bb5cfdf5..ac80c10c10 100644
--- a/ext/session/tests/session_set_cookie_params_variation2.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation2.phpt
@@ -9,12 +9,6 @@ session.cookie_path=/path
ob_start();
-/*
- * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
- * Description : Set the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_cookie_params() : variation ***\n";
var_dump(ini_get("session.cookie_path"));
@@ -40,7 +34,7 @@ string(4) "/foo"
bool(true)
string(4) "/foo"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line 18
+Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
bool(false)
string(4) "/foo"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation3.phpt b/ext/session/tests/session_set_cookie_params_variation3.phpt
index 5a4e2df8fd..1ba46eae7d 100644
--- a/ext/session/tests/session_set_cookie_params_variation3.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation3.phpt
@@ -9,12 +9,6 @@ session.cookie_domain=foo
ob_start();
-/*
- * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
- * Description : Set the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_cookie_params() : variation ***\n";
var_dump(ini_get("session.cookie_domain"));
@@ -40,7 +34,7 @@ string(4) "blah"
bool(true)
string(4) "blah"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line 18
+Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
bool(false)
string(4) "blah"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation4.phpt b/ext/session/tests/session_set_cookie_params_variation4.phpt
index ab0de3bd8b..16606f9f61 100644
--- a/ext/session/tests/session_set_cookie_params_variation4.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation4.phpt
@@ -9,12 +9,6 @@ session.cookie_secure=TRUE
ob_start();
-/*
- * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
- * Description : Set the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_cookie_params() : variation ***\n";
var_dump(ini_get("session.cookie_secure"));
@@ -40,7 +34,7 @@ string(1) "0"
bool(true)
string(1) "0"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line 18
+Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
bool(false)
string(1) "0"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation5.phpt b/ext/session/tests/session_set_cookie_params_variation5.phpt
index f630a5ff4a..a73c834ed7 100644
--- a/ext/session/tests/session_set_cookie_params_variation5.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation5.phpt
@@ -9,12 +9,6 @@ session.cookie_httponly=TRUE
ob_start();
-/*
- * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
- * Description : Set the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_cookie_params() : variation ***\n";
var_dump(ini_get("session.cookie_httponly"));
@@ -40,7 +34,7 @@ string(1) "0"
bool(true)
string(1) "0"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line 18
+Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
bool(false)
string(1) "0"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation6.phpt b/ext/session/tests/session_set_cookie_params_variation6.phpt
index b94380d370..983e8e68ad 100644
--- a/ext/session/tests/session_set_cookie_params_variation6.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation6.phpt
@@ -9,12 +9,6 @@ session.cookie_samesite=test
ob_start();
-/*
- * Prototype : void session_set_cookie_params(array $options)
- * Description : Set the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_cookie_params() : variation ***\n";
var_dump(ini_get("session.cookie_samesite"));
@@ -40,7 +34,7 @@ string(7) "nothing"
bool(true)
string(7) "nothing"
-Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line 18
+Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in %s on line %d
bool(false)
string(7) "nothing"
bool(true)
diff --git a/ext/session/tests/session_set_cookie_params_variation7.phpt b/ext/session/tests/session_set_cookie_params_variation7.phpt
index 1ab248908a..bd5aec592b 100644
--- a/ext/session/tests/session_set_cookie_params_variation7.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation7.phpt
@@ -14,12 +14,6 @@ session.cookie_samesite=""
ob_start();
-/*
- * Prototype : void session_set_cookie_params(array $options)
- * Description : Set the session cookie parameters
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_cookie_params() : array parameter variation ***\n";
// Invalid cases
diff --git a/ext/session/tests/session_set_save_handler_basic.phpt b/ext/session/tests/session_set_save_handler_basic.phpt
index 2a9b511aba..2a451c0644 100644
--- a/ext/session/tests/session_set_save_handler_basic.phpt
+++ b/ext/session/tests/session_set_save_handler_basic.phpt
@@ -12,12 +12,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : basic functionality ***\n";
require_once "save_handler.inc";
diff --git a/ext/session/tests/session_set_save_handler_class_001.phpt b/ext/session/tests/session_set_save_handler_class_001.phpt
index ea8fc81d74..8705c6b953 100644
--- a/ext/session/tests/session_set_save_handler_class_001.phpt
+++ b/ext/session/tests/session_set_save_handler_class_001.phpt
@@ -11,66 +11,60 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : basic class wrapping existing handler ***\n";
class MySession extends SessionHandler {
- public $i = 0;
- public function open($path, $name) {
- ++$this->i;
- echo 'Open ', session_id(), "\n";
- return parent::open($path, $name);
- }
- public function create_sid() {
- // This method should be removed when 5.5 become unsupported.
- ++$this->i;
- echo 'Old Create SID ', session_id(), "\n";
- return parent::create_sid();
- }
- public function read($key) {
- ++$this->i;
- echo 'Read ', session_id(), "\n";
- return parent::read($key);
- }
- public function write($key, $data) {
- ++$this->i;
- echo 'Write ', session_id(), "\n";
- return parent::write($key, $data);
- }
- public function close() {
- ++$this->i;
- echo 'Close ', session_id(), "\n";
- return parent::close();
- }
- public function createSid() {
- // User should use this rather than create_sid()
- // If both create_sid() and createSid() exists,
- // createSid() is used.
- ++$this->i;
- echo 'New Create ID ', session_id(), "\n";
- return parent::create_sid();
- }
- public function validateId($key) {
- ++$this->i;
- echo 'Validate ID ', session_id(), "\n";
- return TRUE;
- // User must implement their own method and
- // cannot call parent as follows.
- // return parent::validateSid($key);
- }
- public function updateTimestamp($key, $data) {
- ++$this->i;
- echo 'Update Timestamp ', session_id(), "\n";
- return parent::write($key, $data);
- // User must implement their own method and
- // cannot call parent as follows
- // return parent::updateTimestamp($key, $data);
- }
+ public $i = 0;
+ public function open($path, $name) {
+ ++$this->i;
+ echo 'Open ', session_id(), "\n";
+ return parent::open($path, $name);
+ }
+ public function create_sid() {
+ // This method should be removed when 5.5 become unsupported.
+ ++$this->i;
+ echo 'Old Create SID ', session_id(), "\n";
+ return parent::create_sid();
+ }
+ public function read($key) {
+ ++$this->i;
+ echo 'Read ', session_id(), "\n";
+ return parent::read($key);
+ }
+ public function write($key, $data) {
+ ++$this->i;
+ echo 'Write ', session_id(), "\n";
+ return parent::write($key, $data);
+ }
+ public function close() {
+ ++$this->i;
+ echo 'Close ', session_id(), "\n";
+ return parent::close();
+ }
+ public function createSid() {
+ // User should use this rather than create_sid()
+ // If both create_sid() and createSid() exists,
+ // createSid() is used.
+ ++$this->i;
+ echo 'New Create ID ', session_id(), "\n";
+ return parent::create_sid();
+ }
+ public function validateId($key) {
+ ++$this->i;
+ echo 'Validate ID ', session_id(), "\n";
+ return TRUE;
+ // User must implement their own method and
+ // cannot call parent as follows.
+ // return parent::validateSid($key);
+ }
+ public function updateTimestamp($key, $data) {
+ ++$this->i;
+ echo 'Update Timestamp ', session_id(), "\n";
+ return parent::write($key, $data);
+ // User must implement their own method and
+ // cannot call parent as follows
+ // return parent::updateTimestamp($key, $data);
+ }
}
$oldHandler = ini_get('session.save_handler');
diff --git a/ext/session/tests/session_set_save_handler_class_002.phpt b/ext/session/tests/session_set_save_handler_class_002.phpt
index 29b1d270c6..bbc39956ff 100644
--- a/ext/session/tests/session_set_save_handler_class_002.phpt
+++ b/ext/session/tests/session_set_save_handler_class_002.phpt
@@ -10,55 +10,49 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : full handler implementation ***\n";
class MySession2 extends SessionHandler {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- return true;
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ return true;
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
}
$handler = new MySession2;
session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
+ array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
session_start();
$_SESSION['foo'] = "hello";
diff --git a/ext/session/tests/session_set_save_handler_class_003.phpt b/ext/session/tests/session_set_save_handler_class_003.phpt
index ba0311b96b..7194bc724d 100644
--- a/ext/session/tests/session_set_save_handler_class_003.phpt
+++ b/ext/session/tests/session_set_save_handler_class_003.phpt
@@ -10,31 +10,25 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : inheritance ***\n";
class MySession3 extends SessionHandler {
- public $i = 0;
- public function open($path, $name) {
- ++$this->i;
- return parent::open($path, $name);
- }
- public function read($key) {
- ++$this->i;
- return parent::read($key);
- }
+ public $i = 0;
+ public function open($path, $name) {
+ ++$this->i;
+ return parent::open($path, $name);
+ }
+ public function read($key) {
+ ++$this->i;
+ return parent::read($key);
+ }
}
class MySession4 extends MySession3 {
- public function write($id, $data) {
- $this->i = "hai";
- return parent::write($id, $data);
- }
+ public function write($id, $data) {
+ $this->i = "hai";
+ return parent::write($id, $data);
+ }
}
$handler = new MySession3;
diff --git a/ext/session/tests/session_set_save_handler_class_004.phpt b/ext/session/tests/session_set_save_handler_class_004.phpt
index eb1d8071ae..d68b3e9623 100644
--- a/ext/session/tests/session_set_save_handler_class_004.phpt
+++ b/ext/session/tests/session_set_save_handler_class_004.phpt
@@ -10,12 +10,6 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : default object ***\n";
session_set_save_handler(new SessionHandler);
diff --git a/ext/session/tests/session_set_save_handler_class_005.phpt b/ext/session/tests/session_set_save_handler_class_005.phpt
index bada7f52c5..d3de39b9e0 100644
--- a/ext/session/tests/session_set_save_handler_class_005.phpt
+++ b/ext/session/tests/session_set_save_handler_class_005.phpt
@@ -11,24 +11,18 @@ session.gc_probability=0
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : incomplete implementation ***\n";
class MySession6 extends SessionHandler {
- public function open($path, $name) {
- // don't call parent
- return true;
- }
-
- public function read($id) {
- // should error because parent::open hasn't been called
- return parent::read($id);
- }
+ public function open($path, $name) {
+ // don't call parent
+ return true;
+ }
+
+ public function read($id) {
+ // should error because parent::open hasn't been called
+ return parent::read($id);
+ }
}
$handler = new MySession6;
diff --git a/ext/session/tests/session_set_save_handler_class_006.phpt b/ext/session/tests/session_set_save_handler_class_006.phpt
index 3f86437207..161fb46d58 100644
--- a/ext/session/tests/session_set_save_handler_class_006.phpt
+++ b/ext/session/tests/session_set_save_handler_class_006.phpt
@@ -10,28 +10,22 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : using objects in close ***\n";
class MySession7_Foo {
- public $state = 'ok';
- function __destruct() {
- $this->state = 'destroyed';
- }
+ public $state = 'ok';
+ function __destruct() {
+ $this->state = 'destroyed';
+ }
}
class MySession7 extends SessionHandler {
- public $foo;
- public function close() {
- var_dump($this->foo);
- @var_dump($GLOBALS['bar']);
- return parent::close();
- }
+ public $foo;
+ public function close() {
+ var_dump($this->foo);
+ @var_dump($GLOBALS['bar']);
+ return parent::close();
+ }
}
$bar = new MySession7_Foo;
diff --git a/ext/session/tests/session_set_save_handler_class_007.phpt b/ext/session/tests/session_set_save_handler_class_007.phpt
index 0416a894c6..5ace4fb9f1 100644
--- a/ext/session/tests/session_set_save_handler_class_007.phpt
+++ b/ext/session/tests/session_set_save_handler_class_007.phpt
@@ -10,37 +10,31 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : manual shutdown, reopen ***\n";
class MySession extends SessionHandler {
- public $num;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- }
- public function finish() {
- $id = session_id();
- echo "(#$this->num) finish called $id\n";
- session_write_close();
- }
- public function write($id, $data) {
- echo "(#$this->num) writing $id = $data\n";
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- echo "(#$this->num) closing $id\n";
- return parent::close();
- }
+ public $num;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ }
+ public function finish() {
+ $id = session_id();
+ echo "(#$this->num) finish called $id\n";
+ session_write_close();
+ }
+ public function write($id, $data) {
+ echo "(#$this->num) writing $id = $data\n";
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ echo "(#$this->num) closing $id\n";
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_008.phpt b/ext/session/tests/session_set_save_handler_class_008.phpt
index da9611a8c7..227fe00961 100644
--- a/ext/session/tests/session_set_save_handler_class_008.phpt
+++ b/ext/session/tests/session_set_save_handler_class_008.phpt
@@ -10,37 +10,31 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : manual shutdown ***\n";
class MySession extends SessionHandler {
- public $num;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- }
- public function finish() {
- $id = session_id();
- echo "(#$this->num) finish called $id\n";
- session_write_close();
- }
- public function write($id, $data) {
- echo "(#$this->num) writing $id = $data\n";
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- echo "(#$this->num) closing $id\n";
- return parent::close();
- }
+ public $num;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ }
+ public function finish() {
+ $id = session_id();
+ echo "(#$this->num) finish called $id\n";
+ session_write_close();
+ }
+ public function write($id, $data) {
+ echo "(#$this->num) writing $id = $data\n";
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ echo "(#$this->num) closing $id\n";
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_009.phpt b/ext/session/tests/session_set_save_handler_class_009.phpt
index d878450540..65e273d5e7 100644
--- a/ext/session/tests/session_set_save_handler_class_009.phpt
+++ b/ext/session/tests/session_set_save_handler_class_009.phpt
@@ -10,37 +10,31 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : implicit shutdown ***\n";
class MySession extends SessionHandler {
- public $num;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- }
- public function finish() {
- $id = session_id();
- echo "(#$this->num) finish called $id\n";
- $this->shutdown();
- }
- public function write($id, $data) {
- echo "(#$this->num) writing $id = $data\n";
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- echo "(#$this->num) closing $id\n";
- return parent::close();
- }
+ public $num;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ }
+ public function finish() {
+ $id = session_id();
+ echo "(#$this->num) finish called $id\n";
+ $this->shutdown();
+ }
+ public function write($id, $data) {
+ echo "(#$this->num) writing $id = $data\n";
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ echo "(#$this->num) closing $id\n";
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_010.phpt b/ext/session/tests/session_set_save_handler_class_010.phpt
index 2424a08d68..c81fce4963 100644
--- a/ext/session/tests/session_set_save_handler_class_010.phpt
+++ b/ext/session/tests/session_set_save_handler_class_010.phpt
@@ -10,37 +10,31 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : manual shutdown function ***\n";
class MySession extends SessionHandler {
- public $num;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- }
- public function finish() {
- $id = session_id();
- echo "(#$this->num) finish called $id\n";
- session_write_close();
- }
- public function write($id, $data) {
- echo "(#$this->num) writing $id = $data\n";
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- echo "(#$this->num) closing $id\n";
- return parent::close();
- }
+ public $num;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ }
+ public function finish() {
+ $id = session_id();
+ echo "(#$this->num) finish called $id\n";
+ session_write_close();
+ }
+ public function write($id, $data) {
+ echo "(#$this->num) writing $id = $data\n";
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ echo "(#$this->num) closing $id\n";
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_011.phpt b/ext/session/tests/session_set_save_handler_class_011.phpt
index 05a84a359a..04defe937e 100644
--- a/ext/session/tests/session_set_save_handler_class_011.phpt
+++ b/ext/session/tests/session_set_save_handler_class_011.phpt
@@ -10,42 +10,36 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : shutdown failure ***\n";
class MySession extends SessionHandler {
- public $num;
- public $destroyed = false;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- $this->destroyed = true;
- }
- public function write($id, $data) {
- if ($this->destroyed) {
- echo "(#$this->num) destroyed, cannot write\n";
- } else {
- echo "(#$this->num) writing $id = $data\n";
- }
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- if ($this->destroyed) {
- echo "(#$this->num) destroyed, cannot write\n";
- } else {
- echo "(#$this->num) closing $id\n";
- }
- return parent::close();
- }
+ public $num;
+ public $destroyed = false;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ $this->destroyed = true;
+ }
+ public function write($id, $data) {
+ if ($this->destroyed) {
+ echo "(#$this->num) destroyed, cannot write\n";
+ } else {
+ echo "(#$this->num) writing $id = $data\n";
+ }
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ if ($this->destroyed) {
+ echo "(#$this->num) destroyed, cannot write\n";
+ } else {
+ echo "(#$this->num) closing $id\n";
+ }
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_012.phpt b/ext/session/tests/session_set_save_handler_class_012.phpt
index b7bcc3fca6..c5bd2b8db1 100644
--- a/ext/session/tests/session_set_save_handler_class_012.phpt
+++ b/ext/session/tests/session_set_save_handler_class_012.phpt
@@ -11,52 +11,44 @@ session.gc_probability=0
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***\n";
class MySession extends SessionHandler {
- public $i = 0;
- public function open($path, $name) {
- ++$this->i;
- echo 'Open ', session_id(), "\n";
- // This test was written for broken return value handling
- // Mimmick what was actually being tested by returning true here
- return (null === parent::open());
- }
- public function read($key) {
- ++$this->i;
- echo 'Read ', session_id(), "\n";
- return parent::read($key);
- }
+ public $i = 0;
+ public function open($path, $name) {
+ ++$this->i;
+ echo 'Open ', session_id(), "\n";
+ // This test was written for broken return value handling
+ // Mimmick what was actually being tested by returning true here
+ return (null === parent::open());
+ }
+ public function read($key) {
+ ++$this->i;
+ echo 'Read ', session_id(), "\n";
+ return parent::read($key);
+ }
}
$oldHandler = ini_get('session.save_handler');
$handler = new MySession;
session_set_save_handler($handler);
-var_dump(session_start());
+try {
+ var_dump(session_start());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
--EXPECTF--
*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***
Open
-Warning: SessionHandler::open() expects exactly 2 parameters, 0 given in %s on line %d
-Read %s
-
-Warning: SessionHandler::read(): Parent session handler is not open in %s on line %d
+Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d
+SessionHandler::open() expects exactly 2 parameters, 0 given
-Warning: SessionHandler::close(): Parent session handler is not open in %s on line %d
-
-Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
-bool(false)
+Warning: Undefined variable $_SESSION in %s on line %d
string(0) ""
string(5) "files"
string(4) "user"
-int(2)
-array(0) {
-}
+int(1)
+NULL
diff --git a/ext/session/tests/session_set_save_handler_class_013.phpt b/ext/session/tests/session_set_save_handler_class_013.phpt
index 28e49c9f98..1ef12bd1f3 100644
--- a/ext/session/tests/session_set_save_handler_class_013.phpt
+++ b/ext/session/tests/session_set_save_handler_class_013.phpt
@@ -10,29 +10,23 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : incorrect arguments for existing handler close ***\n";
class MySession extends SessionHandler {
- public $i = 0;
- public function open($path, $name) {
- ++$this->i;
- echo 'Open ', session_id(), "\n";
- return parent::open($path, $name);
- }
- public function read($key) {
- ++$this->i;
- echo 'Read ', session_id(), "\n";
- return parent::read($key);
- }
- public function close() {
- return parent::close(false);
- }
+ public $i = 0;
+ public function open($path, $name) {
+ ++$this->i;
+ echo 'Open ', session_id(), "\n";
+ return parent::open($path, $name);
+ }
+ public function read($key) {
+ ++$this->i;
+ echo 'Read ', session_id(), "\n";
+ return parent::read($key);
+ }
+ public function close() {
+ return parent::close(false);
+ }
}
$oldHandler = ini_get('session.save_handler');
@@ -41,6 +35,7 @@ session_set_save_handler($handler);
session_start();
var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
+?>
--EXPECTF--
*** Testing session_set_save_handler() : incorrect arguments for existing handler close ***
Open
@@ -52,4 +47,10 @@ int(2)
array(0) {
}
-Warning: SessionHandler::close() expects exactly 0 parameters, 1 given in %s on line %d
+Fatal error: Uncaught ArgumentCountError: SessionHandler::close() expects exactly 0 parameters, 1 given in %s:%d
+Stack trace:
+#0 %s(%d): SessionHandler->close(false)
+#1 [internal function]: MySession->close()
+#2 [internal function]: session_write_close()
+#3 {main}
+ thrown in %s on line %d
diff --git a/ext/session/tests/session_set_save_handler_class_014.phpt b/ext/session/tests/session_set_save_handler_class_014.phpt
index c0b3b9f273..5657e6a71f 100644
--- a/ext/session/tests/session_set_save_handler_class_014.phpt
+++ b/ext/session/tests/session_set_save_handler_class_014.phpt
@@ -14,12 +14,6 @@ include('skipif.inc');
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : calling default handler when save_handler=user ***\n";
$oldHandler = ini_get('session.save_handler');
diff --git a/ext/session/tests/session_set_save_handler_class_015.phpt b/ext/session/tests/session_set_save_handler_class_015.phpt
index 5fab0d4b22..9d7e76c036 100644
--- a/ext/session/tests/session_set_save_handler_class_015.phpt
+++ b/ext/session/tests/session_set_save_handler_class_015.phpt
@@ -10,12 +10,6 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : register session handler but don't start ***\n";
session_set_save_handler(new SessionHandler);
diff --git a/ext/session/tests/session_set_save_handler_class_016.phpt b/ext/session/tests/session_set_save_handler_class_016.phpt
index eadfead304..85964751e0 100644
--- a/ext/session/tests/session_set_save_handler_class_016.phpt
+++ b/ext/session/tests/session_set_save_handler_class_016.phpt
@@ -10,53 +10,47 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() function: class with create_sid ***\n";
class MySession2 extends SessionHandler {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return parent::create_sid();
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return parent::create_sid();
+ }
}
$handler = new MySession2;
diff --git a/ext/session/tests/session_set_save_handler_class_017.phpt b/ext/session/tests/session_set_save_handler_class_017.phpt
index 460552a620..03eaf22947 100644
--- a/ext/session/tests/session_set_save_handler_class_017.phpt
+++ b/ext/session/tests/session_set_save_handler_class_017.phpt
@@ -10,53 +10,47 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() function: class with create_sid ***\n";
class MySession2 extends SessionHandler {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return 'my_sid';
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return pathinfo(__FILE__)['filename'];
+ }
}
$handler = new MySession2;
@@ -72,12 +66,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_class_017');
+--EXPECT--
*** Testing session_set_save_handler() function: class with create_sid ***
-string(%d) "my_sid"
+string(34) "session_set_save_handler_class_017"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_class_018.phpt b/ext/session/tests/session_set_save_handler_class_018.phpt
index c0b2eb61bf..7482cd2901 100644
--- a/ext/session/tests/session_set_save_handler_class_018.phpt
+++ b/ext/session/tests/session_set_save_handler_class_018.phpt
@@ -10,57 +10,51 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() function: class with validate_sid ***\n";
class MySession2 extends SessionHandler {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return @file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return file_put_contents($this->path . $id, $data)===FALSE ? FALSE : TRUE ;
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return 'my_sid';
- }
-
- public function validate_sid($id) {
- return 'my_sid'===$id;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return file_put_contents($this->path . $id, $data)===FALSE ? FALSE : TRUE ;
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return pathinfo(__FILE__)['filename'];
+ }
+
+ public function validate_sid($id) {
+ return pathinfo(__FILE__)['filename']===$id;
+ }
}
$handler = new MySession2;
@@ -76,12 +70,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_class_018');
+--EXPECT--
*** Testing session_set_save_handler() function: class with validate_sid ***
-string(%d) "my_sid"
+string(34) "session_set_save_handler_class_018"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_closures.phpt b/ext/session/tests/session_set_save_handler_closures.phpt
index e490e1780e..df5cfa6e76 100644
--- a/ext/session/tests/session_set_save_handler_closures.phpt
+++ b/ext/session/tests/session_set_save_handler_closures.phpt
@@ -11,12 +11,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : using closures as callbacks ***\n";
require_once "save_handler_closures.inc";
diff --git a/ext/session/tests/session_set_save_handler_error.phpt b/ext/session/tests/session_set_save_handler_error.phpt
index 029d7dcba7..e47523c872 100644
--- a/ext/session/tests/session_set_save_handler_error.phpt
+++ b/ext/session/tests/session_set_save_handler_error.phpt
@@ -7,12 +7,6 @@ Test session_set_save_handler() function : error functionality
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : error functionality ***\n";
// Get an unset variable
diff --git a/ext/session/tests/session_set_save_handler_error2.phpt b/ext/session/tests/session_set_save_handler_error2.phpt
index fcd480f354..8b2a00475d 100644
--- a/ext/session/tests/session_set_save_handler_error2.phpt
+++ b/ext/session/tests/session_set_save_handler_error2.phpt
@@ -9,12 +9,6 @@ error_reporting=0
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : error functionality ***\n";
function open($save_path, $session_name) { return true; }
diff --git a/ext/session/tests/session_set_save_handler_error3.phpt b/ext/session/tests/session_set_save_handler_error3.phpt
index ecb5e5a91d..a57734e411 100644
--- a/ext/session/tests/session_set_save_handler_error3.phpt
+++ b/ext/session/tests/session_set_save_handler_error3.phpt
@@ -11,12 +11,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : error functionality ***\n";
function open($save_path, $session_name) {
throw new Exception("Do something bad..!");
@@ -35,11 +29,11 @@ ob_end_flush();
--EXPECTF--
*** Testing session_set_save_handler() : error functionality ***
-Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line 23
+Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d
-Fatal error: Uncaught Exception: Do something bad..! in %s:13
+Fatal error: Uncaught Exception: Do something bad..! in %s:%d
Stack trace:
#0 [internal function]: open('', 'PHPSESSID')
-#1 %s(23): session_start()
+#1 %s(%d): session_start()
#2 {main}
- thrown in %s on line 13
+ thrown in %s on line %d
diff --git a/ext/session/tests/session_set_save_handler_error4.phpt b/ext/session/tests/session_set_save_handler_error4.phpt
index 00fb2976e3..2b39cb5500 100644
--- a/ext/session/tests/session_set_save_handler_error4.phpt
+++ b/ext/session/tests/session_set_save_handler_error4.phpt
@@ -7,12 +7,6 @@ Test session_set_save_handler() function : error functionality
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : error functionality ***\n";
function callback() { return true; }
diff --git a/ext/session/tests/session_set_save_handler_iface_001.phpt b/ext/session/tests/session_set_save_handler_iface_001.phpt
index 362ad90dd6..9eecaf13bf 100644
--- a/ext/session/tests/session_set_save_handler_iface_001.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_001.phpt
@@ -10,54 +10,48 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() function: interface ***\n";
class MySession2 implements SessionHandlerInterface {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
}
$handler = new MySession2;
session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
+ array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
session_start();
$_SESSION['foo'] = "hello";
diff --git a/ext/session/tests/session_set_save_handler_iface_002.phpt b/ext/session/tests/session_set_save_handler_iface_002.phpt
index bc9f801a5e..c472b9982d 100644
--- a/ext/session/tests/session_set_save_handler_iface_002.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_002.phpt
@@ -10,80 +10,75 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() function: interface wrong ***\n";
interface MySessionHandlerInterface {
- public function open($path, $name);
- public function close();
- public function read($id);
- public function write($id, $data);
- public function destroy($id);
- public function gc($maxlifetime);
+ public function open($path, $name);
+ public function close();
+ public function read($id);
+ public function write($id, $data);
+ public function destroy($id);
+ public function gc($maxlifetime);
}
class MySession2 implements MySessionHandlerInterface {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- echo "Unsupported session handler in use\n";
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ echo "Unsupported session handler in use\n";
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
}
function good_write($id, $data) {
- global $handler;
- echo "good handler writing\n";
- return file_put_contents($handler->path . $id, $data);
+ global $handler;
+ echo "good handler writing\n";
+ return file_put_contents($handler->path . $id, $data);
}
$handler = new MySession2;
$ret = session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), 'good_write', array($handler, 'destroy'), array($handler, 'gc'));
+ array($handler, 'read'), 'good_write', array($handler, 'destroy'), array($handler, 'gc'));
var_dump($ret);
-$ret = session_set_save_handler($handler);
-var_dump($ret);
+try {
+ $ret = session_set_save_handler($handler);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
session_start();
---EXPECTF--
+--EXPECT--
*** Testing session_set_save_handler() function: interface wrong ***
bool(true)
-
-Warning: session_set_save_handler() expects parameter 1 to be SessionHandlerInterface, object given in %s
-bool(false)
+session_set_save_handler(): Argument #1 ($open) must be of type SessionHandlerInterface, MySession2 given
good handler writing
diff --git a/ext/session/tests/session_set_save_handler_iface_003.phpt b/ext/session/tests/session_set_save_handler_iface_003.phpt
index 5a73d6d5f5..561d1f3b44 100644
--- a/ext/session/tests/session_set_save_handler_iface_003.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_003.phpt
@@ -10,54 +10,48 @@ session.name=PHPSESSID
ob_start();
-/*
- * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true])
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() function: id interface ***\n";
class MySession2 implements SessionHandlerInterface, SessionIdInterface {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return @file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- // Empty $data = 0 = false
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return 'my_sid';
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ // Empty $data = 0 = false
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return pathinfo(__FILE__)['filename'];
+ }
}
$handler = new MySession2;
@@ -73,12 +67,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_iface_003');
+--EXPECT--
*** Testing session_set_save_handler() function: id interface ***
-string(%d) "my_sid"
+string(34) "session_set_save_handler_iface_003"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_sid_001.phpt b/ext/session/tests/session_set_save_handler_sid_001.phpt
index 4d297d98f7..d4097158ed 100644
--- a/ext/session/tests/session_set_save_handler_sid_001.phpt
+++ b/ext/session/tests/session_set_save_handler_sid_001.phpt
@@ -13,50 +13,50 @@ ob_start();
echo "*** Testing session_set_save_handler() function: create_sid ***\n";
class MySession2 {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return @file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- // Empty $data = 0 = false
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return 'my_sid';
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ // Empty $data = 0 = false
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return pathinfo(__FILE__)['filename'];
+ }
}
$handler = new MySession2;
session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid'));
+ array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid'));
session_start();
$_SESSION['foo'] = "hello";
@@ -68,12 +68,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_sid_001');
+--EXPECT--
*** Testing session_set_save_handler() function: create_sid ***
-string(%d) "my_sid"
+string(32) "session_set_save_handler_sid_001"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_sid_002.phpt b/ext/session/tests/session_set_save_handler_sid_002.phpt
index 991c731918..0c36c55e2e 100644
--- a/ext/session/tests/session_set_save_handler_sid_002.phpt
+++ b/ext/session/tests/session_set_save_handler_sid_002.phpt
@@ -14,49 +14,49 @@ ob_start();
echo "*** Testing session_set_save_handler() function: create_sid ***\n";
class MySession2 {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return @file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return null;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return @file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return null;
+ }
}
$handler = new MySession2;
session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid'));
+ array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid'));
session_start();
$_SESSION['foo'] = "hello";
diff --git a/ext/session/tests/session_set_save_handler_variation1.phpt b/ext/session/tests/session_set_save_handler_variation1.phpt
index 3362adbac5..e192ac8838 100644
--- a/ext/session/tests/session_set_save_handler_variation1.phpt
+++ b/ext/session/tests/session_set_save_handler_variation1.phpt
@@ -7,12 +7,6 @@ Test session_set_save_handler() function : variation
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : variation ***\n";
var_dump(session_module_name());
diff --git a/ext/session/tests/session_set_save_handler_variation2.phpt b/ext/session/tests/session_set_save_handler_variation2.phpt
index a4e1cdfa6d..394d85e7b1 100644
--- a/ext/session/tests/session_set_save_handler_variation2.phpt
+++ b/ext/session/tests/session_set_save_handler_variation2.phpt
@@ -7,12 +7,6 @@ Test session_set_save_handler() function : variation
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : variation ***\n";
require_once "save_handler.inc";
@@ -28,6 +22,6 @@ ob_end_flush();
*** Testing session_set_save_handler() : variation ***
bool(true)
-Warning: session_set_save_handler(): Cannot change save handler when session is active in %s on line 17
+Warning: session_set_save_handler(): Cannot change save handler when session is active in %s on line %d
bool(false)
bool(true)
diff --git a/ext/session/tests/session_set_save_handler_variation3.phpt b/ext/session/tests/session_set_save_handler_variation3.phpt
index 90c270c644..50fa6f62e0 100644
--- a/ext/session/tests/session_set_save_handler_variation3.phpt
+++ b/ext/session/tests/session_set_save_handler_variation3.phpt
@@ -9,12 +9,6 @@ session.auto_start=1
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : variation ***\n";
require_once "save_handler.inc";
@@ -30,8 +24,8 @@ ob_end_flush();
*** Testing session_set_save_handler() : variation ***
int(2)
-Warning: session_save_path(): Cannot change save path when session is active in %s on line 16
+Warning: session_save_path(): Cannot change save path when session is active in %s on line %d
-Warning: session_set_save_handler(): Cannot change save handler when session is active in %s on line 17
+Warning: session_set_save_handler(): Cannot change save handler when session is active in %s on line %d
bool(false)
bool(true)
diff --git a/ext/session/tests/session_set_save_handler_variation4.phpt b/ext/session/tests/session_set_save_handler_variation4.phpt
index bf74385839..e1b61f29a7 100644
--- a/ext/session/tests/session_set_save_handler_variation4.phpt
+++ b/ext/session/tests/session_set_save_handler_variation4.phpt
@@ -14,18 +14,12 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : variation ***\n";
function noisy_gc($maxlifetime) {
- echo("GC [".$maxlifetime."]\n");
- echo gc($maxlifetime)." deleted\n";
- return true;
+ echo("GC [".$maxlifetime."]\n");
+ echo gc($maxlifetime)." deleted\n";
+ return true;
}
require_once "save_handler.inc";
diff --git a/ext/session/tests/session_set_save_handler_variation5.phpt b/ext/session/tests/session_set_save_handler_variation5.phpt
index 23847aadf4..9860dcc04a 100644
--- a/ext/session/tests/session_set_save_handler_variation5.phpt
+++ b/ext/session/tests/session_set_save_handler_variation5.phpt
@@ -15,16 +15,10 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions with validate_id() and update()
- * Source code : ext/session/session.c
- */
-
function noisy_gc($maxlifetime) {
- echo("GC [".$maxlifetime."]\n");
- echo gc($maxlifetime)." deleted\n";
- return true;
+ echo("GC [".$maxlifetime."]\n");
+ echo gc($maxlifetime)." deleted\n";
+ return true;
}
echo "*** Testing session_set_save_handler() : variation ***\n";
diff --git a/ext/session/tests/session_set_save_handler_variation6.phpt b/ext/session/tests/session_set_save_handler_variation6.phpt
index 7a37198c70..d65c0dc1c8 100644
--- a/ext/session/tests/session_set_save_handler_variation6.phpt
+++ b/ext/session/tests/session_set_save_handler_variation6.phpt
@@ -14,12 +14,6 @@ session.save_handler=files
ob_start();
-/*
- * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
- * Description : Sets user-level session storage functions
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_set_save_handler() : test write short circuit ***\n";
require_once "save_handler.inc";
diff --git a/ext/session/tests/session_start_variation1.phpt b/ext/session/tests/session_start_variation1.phpt
index d76bd8b0f3..b34abbacdd 100644
--- a/ext/session/tests/session_start_variation1.phpt
+++ b/ext/session/tests/session_start_variation1.phpt
@@ -7,12 +7,6 @@ Test session_start() function : variation
ob_start();
-/*
- * Prototype : bool session_start(void)
- * Description : Initialize session data
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_start() : variation ***\n";
var_dump(session_start());
@@ -29,15 +23,15 @@ ob_end_flush();
*** Testing session_start() : variation ***
bool(true)
-Notice: session_start(): A session had already been started - ignoring in %s on line 14
+Notice: session_start(): A session had already been started - ignoring in %s on line %d
bool(true)
-Notice: session_start(): A session had already been started - ignoring in %s on line 15
+Notice: session_start(): A session had already been started - ignoring in %s on line %d
bool(true)
-Notice: session_start(): A session had already been started - ignoring in %s on line 16
+Notice: session_start(): A session had already been started - ignoring in %s on line %d
bool(true)
-Notice: session_start(): A session had already been started - ignoring in %s on line 17
+Notice: session_start(): A session had already been started - ignoring in %s on line %d
bool(true)
Done
diff --git a/ext/session/tests/session_start_variation2.phpt b/ext/session/tests/session_start_variation2.phpt
index 59cbfab326..c88577ab32 100644
--- a/ext/session/tests/session_start_variation2.phpt
+++ b/ext/session/tests/session_start_variation2.phpt
@@ -7,12 +7,6 @@ Test session_start() function : variation
ob_start();
-/*
- * Prototype : bool session_start(void)
- * Description : Initialize session data
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_start() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_start_variation3.phpt b/ext/session/tests/session_start_variation3.phpt
index 8f0b56306f..eab04386fc 100644
--- a/ext/session/tests/session_start_variation3.phpt
+++ b/ext/session/tests/session_start_variation3.phpt
@@ -7,12 +7,6 @@ Test session_start() function : variation
ob_start();
-/*
- * Prototype : bool session_start(void)
- * Description : Initialize session data
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_start() : variation ***\n";
var_dump(session_start());
@@ -43,6 +37,6 @@ bool(true)
bool(true)
bool(true)
-Warning: session_destroy(): Trying to destroy uninitialized session in %s on line 23
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
bool(false)
Done
diff --git a/ext/session/tests/session_start_variation4.phpt b/ext/session/tests/session_start_variation4.phpt
index f14b2574e2..001073a297 100644
--- a/ext/session/tests/session_start_variation4.phpt
+++ b/ext/session/tests/session_start_variation4.phpt
@@ -7,12 +7,6 @@ Test session_start() function : variation
ob_start();
-/*
- * Prototype : bool session_start(void)
- * Description : Initialize session data
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_start() : variation ***\n";
$_SESSION['blah'] = 'foo';
diff --git a/ext/session/tests/session_start_variation5.phpt b/ext/session/tests/session_start_variation5.phpt
index ca5cb85a10..8de4982fb5 100644
--- a/ext/session/tests/session_start_variation5.phpt
+++ b/ext/session/tests/session_start_variation5.phpt
@@ -7,12 +7,6 @@ Test session_start() function : variation
ob_start();
-/*
- * Prototype : bool session_start(void)
- * Description : Initialize session data
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_start() : variation ***\n";
session_start();
diff --git a/ext/session/tests/session_start_variation6.phpt b/ext/session/tests/session_start_variation6.phpt
index 60b1438e45..558baf32b6 100644
--- a/ext/session/tests/session_start_variation6.phpt
+++ b/ext/session/tests/session_start_variation6.phpt
@@ -7,12 +7,6 @@ Test session_start() function : variation
ob_start();
-/*
- * Prototype : bool session_start(void)
- * Description : Initialize session data
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_start() : variation ***\n";
session_start();
diff --git a/ext/session/tests/session_start_variation7.phpt b/ext/session/tests/session_start_variation7.phpt
index 47119f9971..59cd1e529e 100644
--- a/ext/session/tests/session_start_variation7.phpt
+++ b/ext/session/tests/session_start_variation7.phpt
@@ -7,12 +7,6 @@ Test session_start() function : variation
ob_start();
-/*
- * Prototype : bool session_start(void)
- * Description : Initialize session data
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_start() : variation ***\n";
session_start();
diff --git a/ext/session/tests/session_start_variation8.phpt b/ext/session/tests/session_start_variation8.phpt
index 3706ebc26e..2a83e2907a 100644
--- a/ext/session/tests/session_start_variation8.phpt
+++ b/ext/session/tests/session_start_variation8.phpt
@@ -7,12 +7,6 @@ Test session_start() function : variation
ob_start();
-/*
- * Prototype : bool session_start(void)
- * Description : Initialize session data
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_start() : variation ***\n";
var_dump(session_id());
diff --git a/ext/session/tests/session_start_variation9.phpt b/ext/session/tests/session_start_variation9.phpt
index e37c484ee0..99740c0b92 100644
--- a/ext/session/tests/session_start_variation9.phpt
+++ b/ext/session/tests/session_start_variation9.phpt
@@ -9,12 +9,6 @@ session.auto_start=1
ob_start();
-/*
- * Prototype : bool session_start(void)
- * Description : Initialize session data
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_start() : variation ***\n";
var_dump(session_id());
@@ -30,7 +24,7 @@ ob_end_flush();
*** Testing session_start() : variation ***
string(%d) "%s"
-Notice: session_start(): A session had already been started - ignoring in %s on line 14
+Notice: session_start(): A session had already been started - ignoring in %s on line %d
bool(true)
string(%d) "%s"
bool(true)
diff --git a/ext/session/tests/session_unset_basic.phpt b/ext/session/tests/session_unset_basic.phpt
index ba0a58f5a5..575e9a98dc 100644
--- a/ext/session/tests/session_unset_basic.phpt
+++ b/ext/session/tests/session_unset_basic.phpt
@@ -7,12 +7,6 @@ Test session_unset() function : basic functionality
ob_start();
-/*
- * Prototype : void session_unset(void)
- * Description : Free all session variables
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_unset() : basic functionality ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_unset_variation1.phpt b/ext/session/tests/session_unset_variation1.phpt
index 1e3cbf0631..5e17ca751f 100644
--- a/ext/session/tests/session_unset_variation1.phpt
+++ b/ext/session/tests/session_unset_variation1.phpt
@@ -7,12 +7,6 @@ Test session_unset() function : variation
ob_start();
-/*
- * Prototype : void session_unset(void)
- * Description : Free all session variables
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_unset() : variation ***\n";
var_dump(session_unset());
diff --git a/ext/session/tests/session_write_close_basic.phpt b/ext/session/tests/session_write_close_basic.phpt
index c5f44caddb..bbf67d550f 100644
--- a/ext/session/tests/session_write_close_basic.phpt
+++ b/ext/session/tests/session_write_close_basic.phpt
@@ -7,12 +7,6 @@ Test session_write_close() function : basic functionality
ob_start();
-/*
- * Prototype : bool session_write_close(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_write_close() : basic functionality ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_write_close_variation1.phpt b/ext/session/tests/session_write_close_variation1.phpt
index bd849f78d0..d5ae075bd5 100644
--- a/ext/session/tests/session_write_close_variation1.phpt
+++ b/ext/session/tests/session_write_close_variation1.phpt
@@ -7,12 +7,6 @@ Test session_write_close() function : variation
ob_start();
-/*
- * Prototype : bool session_write_close(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_write_close() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_write_close_variation2.phpt b/ext/session/tests/session_write_close_variation2.phpt
index fc1abf833f..02f2611919 100644
--- a/ext/session/tests/session_write_close_variation2.phpt
+++ b/ext/session/tests/session_write_close_variation2.phpt
@@ -7,12 +7,6 @@ Test session_write_close() function : variation
ob_start();
-/*
- * Prototype : bool session_write_close(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_write_close() : variation ***\n";
var_dump(session_start());
diff --git a/ext/session/tests/session_write_close_variation3.phpt b/ext/session/tests/session_write_close_variation3.phpt
index 72e3d2f55a..c726caa248 100644
--- a/ext/session/tests/session_write_close_variation3.phpt
+++ b/ext/session/tests/session_write_close_variation3.phpt
@@ -9,12 +9,6 @@ session.auto_start=1
ob_start();
-/*
- * Prototype : bool session_write_close(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_write_close() : variation ***\n";
var_dump($_SESSION);
diff --git a/ext/session/tests/session_write_close_variation4.phpt b/ext/session/tests/session_write_close_variation4.phpt
index 63311651a8..239086833d 100644
--- a/ext/session/tests/session_write_close_variation4.phpt
+++ b/ext/session/tests/session_write_close_variation4.phpt
@@ -9,12 +9,6 @@ session.use_strict_mode=0
ob_start();
-/*
- * Prototype : bool session_write_close(void)
- * Description : Write session data and end session
- * Source code : ext/session/session.c
- */
-
echo "*** Testing session_write_close() : variation ***\n";
var_dump(session_id("test"));
diff --git a/ext/session/tests/skipif.inc b/ext/session/tests/skipif.inc
index e63f963c5c..c259d9eaca 100644
--- a/ext/session/tests/skipif.inc
+++ b/ext/session/tests/skipif.inc
@@ -9,17 +9,17 @@ if (!extension_loaded("session")) {
}
$save_path = ini_get("session.save_path");
if ($save_path) {
- if (!file_exists($save_path)) {
- die("skip Session save_path doesn't exist");
- }
+ if (!file_exists($save_path)) {
+ die("skip Session save_path doesn't exist");
+ }
- if ($save_path && !@is_writable($save_path)) {
- if (($p = strpos($save_path, ';')) !== false) {
- $save_path = substr($save_path, ++$p);
- }
- if (!@is_writable($save_path)) {
- die("skip session.save_path $save_path is not writable\n");
- }
- }
+ if ($save_path && !@is_writable($save_path)) {
+ if (($p = strpos($save_path, ';')) !== false) {
+ $save_path = substr($save_path, ++$p);
+ }
+ if (!@is_writable($save_path)) {
+ die("skip session.save_path $save_path is not writable\n");
+ }
+ }
}
?>