xref: /PHP-8.1/ext/session/tests/bug70133.phpt (revision b5a14e6c)
1--TEST--
2Bug #70133 (Extended SessionHandler::read is ignoring $session_id when calling parent)
3--EXTENSIONS--
4session
5--SKIPIF--
6<?php include('skipif.inc'); ?>
7--INI--
8session.save_handler=files
9session.save_path=
10session.use_strict_mode=0
11--FILE--
12<?php
13
14class CustomReadHandler extends \SessionHandler {
15
16    public function read($session_id): string|false {
17        return parent::read('mycustomsession');
18    }
19}
20
21ob_start();
22
23session_set_save_handler(new CustomReadHandler(), true);
24
25session_id('mycustomsession');
26session_start();
27$_SESSION['foo'] = 'hoge';
28var_dump(session_id());
29session_commit();
30
31session_id('otherid');
32session_start();
33var_dump($_SESSION);
34var_dump(session_id());
35
36?>
37--EXPECT--
38string(15) "mycustomsession"
39array(1) {
40  ["foo"]=>
41  string(4) "hoge"
42}
43string(7) "otherid"
44