summaryrefslogtreecommitdiff
path: root/ext/session/tests
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2015-01-21 19:13:59 +0900
committerYasuo Ohgaki <yohgaki@php.net>2015-01-22 13:34:58 +0900
commite6c8640a2a242b4c620923dcbe5f93c8366585e7 (patch)
tree4eff7b05ff1c9a44eed52f5c1ae86dcf071cca7a /ext/session/tests
parentebb60ac7dd179a3bea540d50a7d595010a82a656 (diff)
downloadphp-git-e6c8640a2a242b4c620923dcbe5f93c8366585e7.tar.gz
WIP - test passes
Diffstat (limited to 'ext/session/tests')
-rw-r--r--ext/session/tests/save_handler.inc41
-rw-r--r--ext/session/tests/session_basic1.phpt67
-rw-r--r--ext/session/tests/session_basic2.phpt83
-rw-r--r--ext/session/tests/session_commit_variation3.phpt2
-rw-r--r--ext/session/tests/session_commit_variation4.phpt10
-rw-r--r--ext/session/tests/session_commit_variation5.phpt70
-rw-r--r--ext/session/tests/session_decode_variation3.phpt4
-rw-r--r--ext/session/tests/session_set_save_handler_basic.phpt10
-rw-r--r--ext/session/tests/session_set_save_handler_class_001.phpt51
-rw-r--r--ext/session/tests/session_set_save_handler_class_018.phpt94
-rw-r--r--ext/session/tests/session_set_save_handler_variation4.phpt4
-rw-r--r--ext/session/tests/session_set_save_handler_variation5.phpt100
-rw-r--r--ext/session/tests/session_set_save_handler_variation6.phpt (renamed from ext/session/tests/session_set_save_handler_write_short_circuit.phpt)12
-rw-r--r--ext/session/tests/session_start_error.phpt193
14 files changed, 679 insertions, 62 deletions
diff --git a/ext/session/tests/save_handler.inc b/ext/session/tests/save_handler.inc
index d271748259..79ebaaabb0 100644
--- a/ext/session/tests/save_handler.inc
+++ b/ext/session/tests/save_handler.inc
@@ -20,6 +20,8 @@ function read($id) {
$session_id = $id;
echo "Read [${session_save_path},${id}]\n";
$session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
+ // read MUST create file. Otherwise, strict mode will not work
+ touch($session_file);
return (string) @file_get_contents($session_file);
}
@@ -31,7 +33,7 @@ function write($id, $session_data) {
if ($fp = fopen($session_file, "w")) {
$return = fwrite($fp, $session_data);
fclose($fp);
- return (bool)$return;
+ return $return === FALSE ? FALSE : TRUE;
}
return false;
}
@@ -60,5 +62,42 @@ function gc($maxlifetime) {
return true;
}
+function create_sid() {
+ $id = ('PHPT-'.time());
+ echo "CreateID [${id}]\n";
+ return $id;
+}
+
+function validate_sid($id) {
+ global $session_save_path, $name;
+ echo "ValidateID [${session_save_path},${id}]\n";
+ $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
+ $ret = file_exists($session_file);
+ return $ret;
+}
+
+function update($id, $session_data) {
+ global $session_save_path, $name;
+ echo "Update [${session_save_path},${id}]\n";
+ $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
+ $ret = touch($session_file);
+ return $ret;
+}
+
+
+function feature() {
+ /* NOT IMPLEMENTED YET */
+ /* TYPES: gc, create_sid, use_strict_mode, minizie_lock, lazy_write
+ /* VALUES: 0=unknown, 1=supported, 2=partially supported, 3=unsupported */
+ return array('gc'=>0,
+ 'create_sid'=>1,
+ 'use_strict_mode'=>2,
+ 'minimize_lock'=>3,
+ 'lazy_write'=>4,
+ 'invalid'=>5,
+ 'another invalid'=>6
+ );
+}
+
?>
diff --git a/ext/session/tests/session_basic1.phpt b/ext/session/tests/session_basic1.phpt
new file mode 100644
index 0000000000..616fdfc57a
--- /dev/null
+++ b/ext/session/tests/session_basic1.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test basic function : variation1
+--INI--
+session.use_strict_mode=0
+session.save_handler=files
+session.gc_probability=1
+session.gc_divisor=1000
+session.gc_maxlifetime=300
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+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';
+session_id($session_id);
+$path = dirname(__FILE__);
+var_dump(session_save_path($path));
+
+echo "*** Without lazy_write ***\n";
+var_dump(session_id($session_id));
+var_dump(session_start(['lazy_write'=>FALSE]));
+var_dump(session_write_close());
+var_dump(session_id());
+
+echo "*** With lazy_write ***\n";
+var_dump(session_id($session_id));
+var_dump(session_start(['lazy_write'=>TRUE]));
+var_dump(session_commit());
+var_dump(session_id());
+
+echo "*** Cleanup ***\n";
+var_dump(session_id($session_id));
+var_dump(session_start());
+var_dump(session_destroy());
+
+ob_end_flush();
+?>
+--EXPECT--
+*** Testing basic session functionality : variation1 ***
+string(0) ""
+*** Without lazy_write ***
+string(6) "testid"
+bool(true)
+NULL
+string(6) "testid"
+*** With lazy_write ***
+string(6) "testid"
+bool(true)
+NULL
+string(6) "testid"
+*** Cleanup ***
+string(6) "testid"
+bool(true)
+bool(true)
+
diff --git a/ext/session/tests/session_basic2.phpt b/ext/session/tests/session_basic2.phpt
new file mode 100644
index 0000000000..179b82971e
--- /dev/null
+++ b/ext/session/tests/session_basic2.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test basic function : variation2
+--INI--
+session.use_strict_mode=1
+session.save_handler=files
+session.hash_bits_per_character=4
+session.hash_function=0
+session.gc_probability=1
+session.gc_divisor=1000
+session.gc_maxlifetime=300
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+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';
+session_id($session_id);
+$path = dirname(__FILE__);
+var_dump(session_save_path($path));
+
+echo "*** Without lazy_write ***\n";
+var_dump(session_id($session_id));
+var_dump(session_start(['lazy_write'=>FALSE]));
+$session_id_new1 = session_id();
+var_dump($session_id_new1 !== $session_id);
+var_dump(session_write_close());
+var_dump(session_id());
+
+echo "*** With lazy_write ***\n";
+var_dump(session_id($session_id));
+var_dump(session_start(['lazy_write'=>TRUE]));
+$session_id_new2 = session_id();
+var_dump($session_id_new1 !== $session_id_new2);
+var_dump(session_commit());
+var_dump(session_id());
+
+echo "*** Cleanup ***\n";
+ini_set('session.use_strict_mode',0);
+var_dump(session_id($session_id_new1));
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_id($session_id_new2));
+var_dump(session_start());
+var_dump(session_destroy());
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing basic session functionality : variation2 ***
+string(0) ""
+*** Without lazy_write ***
+string(6) "testid"
+bool(true)
+bool(true)
+NULL
+string(32) "%s"
+*** With lazy_write ***
+string(32) "%s"
+bool(true)
+bool(true)
+NULL
+string(32) "%s"
+*** Cleanup ***
+string(32) "%s"
+bool(true)
+bool(true)
+string(0) ""
+bool(true)
+bool(true)
+
+
diff --git a/ext/session/tests/session_commit_variation3.phpt b/ext/session/tests/session_commit_variation3.phpt
index 4cee2f4d58..998e60340f 100644
--- a/ext/session/tests/session_commit_variation3.phpt
+++ b/ext/session/tests/session_commit_variation3.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test session_start() function : variation
+Test session_commit() function : variation
--SKIPIF--
<?php include('skipif.inc'); ?>
--INI--
diff --git a/ext/session/tests/session_commit_variation4.phpt b/ext/session/tests/session_commit_variation4.phpt
index 69854a6cf9..fdc4ca5186 100644
--- a/ext/session/tests/session_commit_variation4.phpt
+++ b/ext/session/tests/session_commit_variation4.phpt
@@ -9,20 +9,22 @@ 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
+ * Source code : ext/session/session.c
*/
echo "*** Testing session_commit() : variation ***\n";
+var_dump(ini_get('session.use_strict_mode'));
var_dump(session_id("test"));
var_dump(session_start());
var_dump(session_id());
var_dump(session_commit());
var_dump(session_id());
var_dump(session_start());
+var_dump(ini_get('session.use_strict_mode'));
var_dump(session_id());
var_dump(session_commit());
var_dump(session_id());
@@ -32,18 +34,21 @@ var_dump(session_commit());
var_dump(session_id());
var_dump(session_start());
var_dump(session_destroy());
+var_dump(ini_get('session.use_strict_mode'));
echo "Done";
ob_end_flush();
?>
--EXPECTF--
*** Testing session_commit() : variation ***
+string(1) "0"
string(0) ""
bool(true)
string(4) "test"
NULL
string(4) "test"
bool(true)
+string(1) "0"
string(4) "test"
NULL
string(4) "test"
@@ -53,5 +58,6 @@ NULL
string(4) "test"
bool(true)
bool(true)
+string(1) "0"
Done
diff --git a/ext/session/tests/session_commit_variation5.phpt b/ext/session/tests/session_commit_variation5.phpt
new file mode 100644
index 0000000000..62bd1c1511
--- /dev/null
+++ b/ext/session/tests/session_commit_variation5.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test session_commit() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_strict_mode=0
+--FILE--
+<?php
+
+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());
+var_dump(session_id($id));
+var_dump(session_start());
+var_dump(session_id());
+var_dump($id === session_id());
+var_dump(session_commit());
+var_dump($id === session_id());
+var_dump(session_id());
+var_dump(session_start());
+var_dump($id === session_id());
+var_dump(session_id());
+var_dump(session_commit());
+var_dump($id === session_id());
+var_dump(session_id());
+var_dump(session_start());
+var_dump($id === session_id());
+var_dump(session_id());
+var_dump(session_commit());
+var_dump($id === session_id());
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_commit() : variation ***
+string(0) ""
+bool(true)
+string(32) "%s"
+bool(true)
+NULL
+bool(true)
+string(32) "%s"
+bool(true)
+bool(true)
+string(32) "%s"
+NULL
+bool(true)
+string(32) "%s"
+bool(true)
+bool(true)
+string(32) "%s"
+NULL
+bool(true)
+string(32) "%s"
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_decode_variation3.phpt b/ext/session/tests/session_decode_variation3.phpt
index 4a6f768713..3557efa46d 100644
--- a/ext/session/tests/session_decode_variation3.phpt
+++ b/ext/session/tests/session_decode_variation3.phpt
@@ -48,8 +48,8 @@ array(3) {
float(123.456)
}
-Warning: session_decode(): Unknown session.serialize_handler. Failed to decode session object in %s on line %d
-bool(true)
+Warning: session_decode(): Session is not active. You cannot decode session data in %s on line %d
+bool(false)
array(3) {
["foo"]=>
int(1234567890)
diff --git a/ext/session/tests/session_set_save_handler_basic.phpt b/ext/session/tests/session_set_save_handler_basic.phpt
index e8496e8afb..c8b406e5ab 100644
--- a/ext/session/tests/session_set_save_handler_basic.phpt
+++ b/ext/session/tests/session_set_save_handler_basic.phpt
@@ -46,6 +46,11 @@ var_dump($_SESSION);
$_SESSION['Bar'] = 'Foo';
session_write_close();
+echo "Cleanup..\n";
+session_id($session_id);
+session_start();
+session_destroy();
+
ob_end_flush();
?>
--EXPECTF--
@@ -94,3 +99,8 @@ array(3) {
}
Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";]
Close [%s,PHPSESSID]
+Cleanup..
+Open [%s,PHPSESSID]
+Read [%s,%s]
+Destroy [%s,%s]
+Close [%s,PHPSESSID]
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 83e899a2bc..f1656c3b5b 100644
--- a/ext/session/tests/session_set_save_handler_class_001.phpt
+++ b/ext/session/tests/session_set_save_handler_class_001.phpt
@@ -1,6 +1,7 @@
--TEST--
Test session_set_save_handler() : basic class wrapping existing handler
--INI--
+session.use_strict_mode=1
session.save_handler=files
session.name=PHPSESSID
--SKIPIF--
@@ -25,11 +26,51 @@ class MySession extends SessionHandler {
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');
@@ -49,20 +90,28 @@ var_dump($_SESSION);
session_write_close();
session_unset();
+var_dump($handler->i);
--EXPECTF--
*** Testing session_set_save_handler() : basic class wrapping existing handler ***
Open
+Old Create SID
Read %s
string(%d) "%s"
string(5) "files"
string(4) "user"
-int(2)
+int(3)
array(0) {
}
+Write %s
+Close %s
Open %s
+Validate ID %s
Read %s
array(1) {
["foo"]=>
string(5) "hello"
}
+Update Timestamp %s
+Close %s
+int(10)
diff --git a/ext/session/tests/session_set_save_handler_class_018.phpt b/ext/session/tests/session_set_save_handler_class_018.phpt
new file mode 100644
index 0000000000..7ff06e38cb
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_class_018.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test session_set_save_handler() function: class with validate_sid
+--INI--
+session.save_handler=files
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+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;
+ }
+}
+
+$handler = new MySession2;
+session_set_save_handler($handler);
+session_start();
+
+$_SESSION['foo'] = "hello";
+
+var_dump(session_id(), ini_get('session.save_handler'), $_SESSION);
+
+session_write_close();
+session_unset();
+
+session_start();
+var_dump($_SESSION);
+
+session_write_close();
+session_unset();
+
+--EXPECTF--
+*** Testing session_set_save_handler() function: class with validate_sid ***
+string(%d) "my_sid"
+string(4) "user"
+array(1) {
+ ["foo"]=>
+ string(5) "hello"
+}
+array(1) {
+ ["foo"]=>
+ string(5) "hello"
+}
diff --git a/ext/session/tests/session_set_save_handler_variation4.phpt b/ext/session/tests/session_set_save_handler_variation4.phpt
index c34eb9cd9f..56b8a67f2a 100644
--- a/ext/session/tests/session_set_save_handler_variation4.phpt
+++ b/ext/session/tests/session_set_save_handler_variation4.phpt
@@ -23,7 +23,7 @@ echo "*** Testing session_set_save_handler() : variation ***\n";
function noisy_gc($maxlifetime) {
echo("GC [".$maxlifetime."]\n");
- gc($maxlifetime);
+ echo gc($maxlifetime)." deleted\n";
return true;
}
@@ -54,6 +54,7 @@ ob_end_flush();
Open [%s,PHPSESSID]
Read [%s,%s]
GC [0]
+1 deleted
array(3) {
["Blah"]=>
string(12) "Hello World!"
@@ -68,6 +69,7 @@ NULL
Open [%s,PHPSESSID]
Read [%s,%s]
GC [0]
+1 deleted
array(3) {
["Blah"]=>
string(12) "Hello World!"
diff --git a/ext/session/tests/session_set_save_handler_variation5.phpt b/ext/session/tests/session_set_save_handler_variation5.phpt
new file mode 100644
index 0000000000..e1c0de4d57
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_variation5.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Test session_set_save_handler() function : variation
+--INI--
+session.use_strict_mode=1
+session.gc_probability=1
+session.gc_divisor=1
+session.gc_maxlifetime=0
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+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 "*** Testing session_set_save_handler() : variation ***\n";
+
+require_once "save_handler.inc";
+$session_id = 'testid';
+$path = dirname(__FILE__);
+var_dump(session_save_path($path));
+
+echo "*** Without lazy_write ***\n";
+var_dump(session_id($session_id));
+var_dump(session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc", "create_sid", "validate_sid", "update"));
+var_dump(session_start(['lazy_write'=>FALSE]));
+var_dump(session_write_close());
+var_dump(session_id());
+
+echo "*** With lazy_write ***\n";
+var_dump(session_id($session_id));
+var_dump(session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc", "create_sid", "validate_sid", "update"));
+var_dump(session_start(['lazy_write'=>TRUE]));
+var_dump(session_commit());
+var_dump(session_id());
+
+echo "*** Cleanup ***\n";
+var_dump(session_id($session_id));
+var_dump(session_start());
+var_dump(session_destroy());
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : variation ***
+
+string(0) ""
+*** Without lazy_write ***
+string(0) ""
+bool(true)
+Open [%s,PHPSESSID]
+ValidateID [%s,testid]
+CreateID [PHPT-%d]
+Read [%s,PHPT-%d]
+GC [0]
+1 deleted
+bool(true)
+Write [%s,PHPT-%d,]
+Close [%s,PHPSESSID]
+NULL
+string(15) "PHPT-%d"
+*** With lazy_write ***
+string(15) "PHPT-%d"
+bool(true)
+Open [%s,PHPSESSID]
+ValidateID [%s,PHPT-%d]
+Read [%s,PHPT-%d]
+GC [0]
+1 deleted
+Write [%s,PHPT-%d,]
+Close [%s,PHPSESSID]
+bool(true)
+NULL
+string(15) "PHPT-%d"
+*** Cleanup ***
+string(15) "PHPT-%d"
+Open [%s,PHPSESSID]
+ValidateID [%s,PHPT-%d]
+Read [%s,PHPT-%d]
+GC [0]
+1 deleted
+bool(true)
+Destroy [%s,PHPT-%d]
+
+Warning: unlink(%s/session_test_PHPT-%s): No such file or directory in %s/save_handler.inc on line %d
+Close [%s,PHPSESSID]
+bool(true)
diff --git a/ext/session/tests/session_set_save_handler_write_short_circuit.phpt b/ext/session/tests/session_set_save_handler_variation6.phpt
index 08da29a8fd..159c85d631 100644
--- a/ext/session/tests/session_set_save_handler_write_short_circuit.phpt
+++ b/ext/session/tests/session_set_save_handler_variation6.phpt
@@ -1,11 +1,11 @@
--TEST--
-Test session_set_save_handler() function : test write short circuit
+Test session_set_save_handler() function : test lazy_write
--INI--
+session.lazy_write=1
session.save_path=
session.name=PHPSESSID
--SKIPIF--
<?php include('skipif.inc'); ?>
-skip - Waiting RFC patch merge
--FILE--
<?php
@@ -22,7 +22,7 @@ echo "*** Testing session_set_save_handler() : test write short circuit ***\n";
require_once "save_handler.inc";
$path = dirname(__FILE__);
session_save_path($path);
-session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc", "create_sid", "validate_sid", "update");
session_start();
$session_id = session_id();
@@ -37,7 +37,7 @@ var_dump($_SESSION);
echo "Starting session again..!\n";
session_id($session_id);
-session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc", "create_sid", "validate_sid", "update");
session_start();
var_dump($_SESSION);
$_SESSION['Bar'] = 'Foo';
@@ -45,7 +45,7 @@ session_write_close();
echo "Starting session again..!\n";
session_id($session_id);
-session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc", "create_sid", "validate_sid", "update");
session_start();
var_dump($_SESSION);
// $_SESSION should be the same and should skip write()
@@ -57,6 +57,7 @@ ob_end_flush();
*** Testing session_set_save_handler() : test write short circuit ***
Open [%s,PHPSESSID]
+CreateID [PHPT-%s]
Read [%s,%s]
array(3) {
["Blah"]=>
@@ -102,4 +103,5 @@ array(4) {
["Bar"]=>
string(3) "Foo"
}
+Update [%s,PHPT-%d]
Close [%s,PHPSESSID] \ No newline at end of file
diff --git a/ext/session/tests/session_start_error.phpt b/ext/session/tests/session_start_error.phpt
index 8cbf42c860..5a0bcefc2a 100644
--- a/ext/session/tests/session_start_error.phpt
+++ b/ext/session/tests/session_start_error.phpt
@@ -97,99 +97,194 @@ ob_end_flush();
*** Testing session_start() : error functionality ***
-- Iteration 1 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 2 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 3 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 4 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 5 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, float given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 6 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, float given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 7 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, float given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 8 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, float given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 9 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, float given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 10 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 11 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 12 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 13 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 14 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 15 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 16 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 17 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 18 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 19 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 20 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 21 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 22 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 23 --
-bool(true)
-bool(true)
+
+Warning: session_start() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
-- Iteration 24 --
-bool(true)
-bool(true)
-Done
+Warning: session_start() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
+Done