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