xref: /PHP-8.0/ext/session/tests/bug63379.phpt (revision 7aacc705)
1--TEST--
2Bug #63379: Warning when using session_regenerate_id(TRUE) with a SessionHandler
3--INI--
4session.save_handler=files
5session.name=PHPSESSID
6--SKIPIF--
7<?php include('skipif.inc'); ?>
8--FILE--
9<?php
10
11ob_start();
12
13$handler = new SessionHandler;
14session_set_save_handler($handler);
15
16session_start();
17
18$_SESSION['foo'] = 'hello';
19var_dump($_SESSION);
20
21session_regenerate_id(true);
22
23echo "*** Regenerated ***\n";
24var_dump($_SESSION);
25
26$_SESSION['bar'] = 'world';
27
28var_dump($_SESSION);
29
30session_write_close();
31session_unset();
32
33session_start();
34var_dump($_SESSION);
35?>
36--EXPECT--
37array(1) {
38  ["foo"]=>
39  string(5) "hello"
40}
41*** Regenerated ***
42array(1) {
43  ["foo"]=>
44  string(5) "hello"
45}
46array(2) {
47  ["foo"]=>
48  string(5) "hello"
49  ["bar"]=>
50  string(5) "world"
51}
52array(2) {
53  ["foo"]=>
54  string(5) "hello"
55  ["bar"]=>
56  string(5) "world"
57}
58