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