xref: /PHP-8.0/ext/session/tests/027.phpt (revision 7f196e32)
1--TEST--
2unset($_SESSION["name"]); should work
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--INI--
6session.use_cookies=0
7session.use_strict_mode=0
8session.cache_limiter=
9session.serialize_handler=php
10session.save_handler=files
11--FILE--
12<?php
13error_reporting(E_ALL);
14ob_start();
15
16session_id("abtest");
17
18### Phase 1 cleanup
19session_start();
20session_destroy();
21
22### Phase 2 $_SESSION["c"] does not contain any value
23session_id("abtest");
24session_start();
25var_dump($_SESSION);
26$_SESSION["name"] = "foo";
27var_dump($_SESSION);
28session_write_close();
29
30### Phase 3 $_SESSION["c"] is set
31session_start();
32var_dump($_SESSION);
33unset($_SESSION["name"]);
34var_dump($_SESSION);
35session_write_close();
36
37### Phase 4 final
38
39session_start();
40var_dump($_SESSION);
41session_destroy();
42?>
43--EXPECT--
44array(0) {
45}
46array(1) {
47  ["name"]=>
48  string(3) "foo"
49}
50array(1) {
51  ["name"]=>
52  string(3) "foo"
53}
54array(0) {
55}
56array(0) {
57}
58