1--TEST--
2Test session_module_name() function : variation
3--INI--
4session.save_path=
5session.name=PHPSESSID
6session.save_handler=files
7--EXTENSIONS--
8session
9--SKIPIF--
10<?php include('skipif.inc'); ?>
11--FILE--
12<?php
13
14ob_start();
15
16echo "*** Testing session_module_name() : variation ***\n";
17
18class MySessionHandler implements SessionHandlerInterface {
19    public function open($save_path, $session_name): bool {
20        throw new Exception("Stop...!");
21    }
22    public function close(): bool { return true; }
23    public function read($id): string|false { return ''; }
24    public function write($id, $session_data): bool { return true; }
25    public function destroy($id): bool { return true; }
26    public function gc($maxlifetime): int { return 1; }
27}
28
29var_dump(session_module_name("files"));
30session_set_save_handler(new MySessionHandler());
31var_dump(session_module_name());
32var_dump(session_start());
33var_dump(session_module_name());
34var_dump(session_destroy());
35
36ob_end_flush();
37?>
38--EXPECTF--
39*** Testing session_module_name() : variation ***
40string(5) "files"
41string(4) "user"
42
43Fatal error: Uncaught Exception: Stop...! in %s:%d
44Stack trace:
45#0 [internal function]: MySessionHandler->open('', 'PHPSESSID')
46#1 %s(%d): session_start()
47#2 {main}
48  thrown in %s on line %d
49