1--TEST--
2Test session_module_name() function : variation
3--INI--
4session.save_path=
5session.name=PHPSESSID
6session.save_handler=files
7--SKIPIF--
8<?php include('skipif.inc'); ?>
9--FILE--
10<?php
11
12ob_start();
13
14/*
15 * Prototype : string session_module_name([string $module])
16 * Description : Get and/or set the current session module
17 * Source code : ext/session/session.c
18 */
19
20echo "*** Testing session_module_name() : variation ***\n";
21function open($save_path, $session_name) {
22    throw new Exception("Stop...!");
23}
24
25function close() { return true; }
26function read($id) { return ''; }
27function write($id, $session_data) { return true; }
28function destroy($id) { return true; }
29function gc($maxlifetime) { return true; }
30
31var_dump(session_module_name("files"));
32session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
33var_dump(session_module_name());
34var_dump(session_start());
35var_dump(session_module_name());
36var_dump(session_destroy());
37
38ob_end_flush();
39?>
40--EXPECTF--
41*** Testing session_module_name() : variation ***
42string(%d) "%s"
43string(4) "user"
44
45Warning: Uncaught Exception: Stop...! in %s:%d
46Stack trace:
47#0 [internal function]: open('', 'PHPSESSID')
48#1 %s(%d): session_start()
49#2 {main}
50  thrown in %s on line %d
51
52Fatal error: session_start(): Failed to initialize storage module: %s in %s%esession_module_name_variation3.php on line %d
53