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