xref: /PHP-7.4/ext/session/tests/bug63379.phpt (revision d679f022)
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--EXPECT--
36array(1) {
37  ["foo"]=>
38  string(5) "hello"
39}
40*** Regenerated ***
41array(1) {
42  ["foo"]=>
43  string(5) "hello"
44}
45array(2) {
46  ["foo"]=>
47  string(5) "hello"
48  ["bar"]=>
49  string(5) "world"
50}
51array(2) {
52  ["foo"]=>
53  string(5) "hello"
54  ["bar"]=>
55  string(5) "world"
56}
57