1--TEST--
2Test session_set_save_handler() function : basic functionality
3--INI--
4session.save_path=
5session.name=PHPSESSID
6--SKIPIF--
7<?php include('skipif.inc'); ?>
8--FILE--
9<?php
10
11ob_start();
12
13/*
14 * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
15 * Description : Sets user-level session storage functions
16 * Source code : ext/session/session.c
17 */
18
19echo "*** Testing session_set_save_handler() : basic functionality ***\n";
20
21require_once "save_handler.inc";
22var_dump(session_module_name());
23var_dump(session_module_name(FALSE));
24var_dump(session_module_name("blah"));
25var_dump(session_module_name("foo"));
26
27$path = dirname(__FILE__);
28session_save_path($path);
29session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
30
31session_start();
32$_SESSION["Blah"] = "Hello World!";
33$_SESSION["Foo"] = FALSE;
34$_SESSION["Guff"] = 1234567890;
35var_dump($_SESSION);
36
37session_write_close();
38session_unset();
39var_dump($_SESSION);
40
41echo "Starting session again..!\n";
42session_id($session_id);
43session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
44session_start();
45var_dump($_SESSION);
46session_write_close();
47
48ob_end_flush();
49?>
50--EXPECTF--
51*** Testing session_set_save_handler() : basic functionality ***
52
53string(%d) "%s"
54
55Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
56bool(false)
57
58Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d
59bool(false)
60
61Warning: session_module_name(): Cannot find named PHP session module (foo) in %s on line %d
62bool(false)
63Open [%s,PHPSESSID]
64Read [%s,%s]
65array(3) {
66  ["Blah"]=>
67  string(12) "Hello World!"
68  ["Foo"]=>
69  bool(false)
70  ["Guff"]=>
71  int(1234567890)
72}
73Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;]
74Close [%s,PHPSESSID]
75array(3) {
76  ["Blah"]=>
77  string(12) "Hello World!"
78  ["Foo"]=>
79  bool(false)
80  ["Guff"]=>
81  int(1234567890)
82}
83Starting session again..!
84Open [%s,PHPSESSID]
85Read [%s,%s]
86array(3) {
87  ["Blah"]=>
88  string(12) "Hello World!"
89  ["Foo"]=>
90  bool(false)
91  ["Guff"]=>
92  int(1234567890)
93}
94Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;]
95Close [%s,PHPSESSID]
96