summaryrefslogtreecommitdiff
path: root/ext/session/tests/session_basic1.phpt
blob: 658c8e72878b4af01586bb5bdd5c1e7df029caca (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
--TEST--
Test basic function : variation1
--INI--
session.use_strict_mode=0
session.save_handler=files
session.gc_probability=1
session.gc_divisor=1000
session.gc_maxlifetime=300
session.save_path=
session.name=PHPSESSID
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php

ob_start();

/*
 * Prototype : session.use_strict_mode=0
 * Description : Test basic functionality.
 * Source code : ext/session/session.c, ext/session/mod_files.c
 */

echo "*** Testing basic session functionality : variation1 ***\n";

$session_id = 'testid';
session_id($session_id);
$path = __DIR__;
var_dump(session_save_path($path));

echo "*** Without lazy_write ***\n";
var_dump(session_id($session_id));
$config = ['lazy_write'=>FALSE];
var_dump(session_start($config));
var_dump($config);
var_dump(session_write_close());
var_dump(session_id());

echo "*** With lazy_write ***\n";
var_dump(session_id($session_id));
var_dump(session_start(['lazy_write'=>TRUE]));
var_dump(session_commit());
var_dump(session_id());

echo "*** Cleanup ***\n";
var_dump(session_id($session_id));
var_dump(session_start());
var_dump(session_destroy());

ob_end_flush();
?>
--EXPECT--
*** Testing basic session functionality : variation1 ***
string(0) ""
*** Without lazy_write ***
string(6) "testid"
bool(true)
array(1) {
  ["lazy_write"]=>
  bool(false)
}
bool(true)
string(6) "testid"
*** With lazy_write ***
string(6) "testid"
bool(true)
bool(true)
string(6) "testid"
*** Cleanup ***
string(6) "testid"
bool(true)
bool(true)