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