summaryrefslogtreecommitdiff
path: root/ext/session/tests/session_reset_basic.phpt
blob: 75c6a041191061561280efe65d989764c77400d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--TEST--
Test session_reset() function : basic functionality
--SKIPIF--
<?php include('skipif.inc'); ?>
--INI--
session.save_path=
session.name=PHPSESSID
--FILE--
<?php

ob_start();

/*
 * Prototype : void session_reset(void)
 * Description : Should abort session. Session data should not be written.
 * Source code : ext/session/session.c
 */

echo "*** Testing session_abort() : basic functionality ***\n";

session_start();
$session_id = session_id();
$_SESSION['foo'] = 123;
session_commit();

session_id($session_id);
session_start();
$_SESSION['bar'] = 456;
var_dump($_SESSION);
session_reset();

var_dump($_SESSION); // Should only have 'foo'

echo "Done".PHP_EOL;

?>
--EXPECTF--
*** Testing session_abort() : basic functionality ***
array(2) {
  ["foo"]=>
  int(123)
  ["bar"]=>
  int(456)
}
array(1) {
  ["foo"]=>
  int(123)
}
Done