1--TEST--
2Test session_set_save_handler() function : variation
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--INI--
6session.gc_probability=1
7session.gc_divisor=1
8session.gc_maxlifetime=0
9session.save_path=
10session.name=PHPSESSID
11session.save_handler=files
12--FILE--
13<?php
14
15ob_start();
16
17echo "*** Testing session_set_save_handler() : variation ***\n";
18
19function noisy_gc($maxlifetime) {
20    echo("GC [".$maxlifetime."]\n");
21    echo gc($maxlifetime)." deleted\n";
22    return true;
23}
24
25require_once "save_handler.inc";
26$path = __DIR__;
27session_save_path($path);
28session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc");
29
30session_start();
31$_SESSION["Blah"] = "Hello World!";
32$_SESSION["Foo"] = FALSE;
33$_SESSION["Guff"] = 1234567890;
34var_dump($_SESSION);
35$session_id = session_id();
36var_dump(session_write_close());
37
38session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc");
39session_id($session_id);
40session_start();
41var_dump($_SESSION);
42var_dump(session_destroy());
43
44ob_end_flush();
45?>
46--EXPECTF--
47*** Testing session_set_save_handler() : variation ***
48Open [%s,PHPSESSID]
49Read [%s,%s]
50GC [0]
511 deleted
52array(3) {
53  ["Blah"]=>
54  string(12) "Hello World!"
55  ["Foo"]=>
56  bool(false)
57  ["Guff"]=>
58  int(1234567890)
59}
60Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;]
61Close [%s,PHPSESSID]
62bool(true)
63Open [%s,PHPSESSID]
64Read [%s,%s]
65GC [0]
661 deleted
67array(3) {
68  ["Blah"]=>
69  string(12) "Hello World!"
70  ["Foo"]=>
71  bool(false)
72  ["Guff"]=>
73  int(1234567890)
74}
75Destroy [%s,%s]
76
77Warning: unlink(%s): No such file or directory in %s on line %d
78Close [%s,PHPSESSID]
79bool(true)
80