xref: /PHP-8.2/ext/session/tests/bug80889.phpt (revision b5a14e6c)
1--TEST--
2Bug #80889 (Cannot set save handler when save_handler is invalid)
3--EXTENSIONS--
4session
5--SKIPIF--
6<?php include('skipif.inc'); ?>
7--INI--
8session.save_handler=whatever
9--FILE--
10<?php
11class DummyHandler implements SessionHandlerInterface {
12    public function open($savePath, $sessionName): bool {
13        return true;
14    }
15    public function close(): bool {
16        return true;
17    }
18    public function read($id): string|false {
19        return '';
20    }
21    public function write($id, $data): bool {
22        return true;
23    }
24    public function destroy($id): bool {
25        return true;
26    }
27    public function gc($maxlifetime): int|false {
28        return true;
29    }
30}
31
32$initHandler = ini_get('session.save_handler');
33session_set_save_handler(new DummyHandler());
34$setHandler = ini_get('session.save_handler');
35var_dump($initHandler, $setHandler);
36?>
37--EXPECT--
38string(8) "whatever"
39string(4) "user"
40