1--TEST--
2Test session_set_save_handler() function : error functionality
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--FILE--
6<?php
7
8ob_start();
9
10/*
11 * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
12 * Description : Sets user-level session storage functions
13 * Source code : ext/session/session.c
14 */
15
16echo "*** Testing session_set_save_handler() : error functionality ***\n";
17
18function open($save_path, $session_name) { return true; }
19function close() { return true; }
20function read($id) { return false; }
21function write($id, $session_data) { }
22function destroy($id) {  return true; }
23function gc($maxlifetime) {  return true; }
24
25session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
26
27session_start();
28$_SESSION["Blah"] = "Hello World!";
29$_SESSION["Foo"] = FALSE;
30$_SESSION["Guff"] = 1234567890;
31var_dump($_SESSION);
32
33session_write_close();
34var_dump($_SESSION);
35session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
36session_start();
37var_dump($_SESSION);
38session_destroy();
39
40ob_end_flush();
41?>
42--EXPECTF--
43*** Testing session_set_save_handler() : error functionality ***
44array(3) {
45  ["Blah"]=>
46  string(12) "Hello World!"
47  ["Foo"]=>
48  bool(false)
49  ["Guff"]=>
50  int(1234567890)
51}
52array(3) {
53  ["Blah"]=>
54  string(12) "Hello World!"
55  ["Foo"]=>
56  bool(false)
57  ["Guff"]=>
58  int(1234567890)
59}
60array(0) {
61}
62
63