1--TEST--
2Test session_get_cookie_params() function : basic functionality
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--INI--
6session.cookie_lifetime=0
7session.cookie_path="/"
8session.cookie_domain=""
9session.cookie_secure=0
10session.cookie_httponly=0
11session.cookie_samesite=""
12--FILE--
13<?php
14
15ob_start();
16
17/*
18 * Prototype : array session_get_cookie_params(void)
19 * Description : Get the session cookie parameters
20 * Source code : ext/session/session.c
21 */
22
23echo "*** Testing session_get_cookie_params() : basic functionality ***\n";
24
25var_dump(session_get_cookie_params());
26var_dump(session_set_cookie_params(3600, "/path", "blah", FALSE, FALSE));
27var_dump(session_get_cookie_params());
28var_dump(session_set_cookie_params(1234567890, "/guff", "foo", TRUE, TRUE));
29var_dump(session_get_cookie_params());
30var_dump(session_set_cookie_params([
31  "lifetime" => 123,
32  "path" => "/bar",
33  "domain" => "baz",
34  "secure" => FALSE,
35  "httponly" => FALSE,
36  "samesite" => "please"]));
37var_dump(session_get_cookie_params());
38
39echo "Done";
40ob_end_flush();
41?>
42--EXPECT--
43*** Testing session_get_cookie_params() : basic functionality ***
44array(6) {
45  ["lifetime"]=>
46  int(0)
47  ["path"]=>
48  string(1) "/"
49  ["domain"]=>
50  string(0) ""
51  ["secure"]=>
52  bool(false)
53  ["httponly"]=>
54  bool(false)
55  ["samesite"]=>
56  string(0) ""
57}
58bool(true)
59array(6) {
60  ["lifetime"]=>
61  int(3600)
62  ["path"]=>
63  string(5) "/path"
64  ["domain"]=>
65  string(4) "blah"
66  ["secure"]=>
67  bool(false)
68  ["httponly"]=>
69  bool(false)
70  ["samesite"]=>
71  string(0) ""
72}
73bool(true)
74array(6) {
75  ["lifetime"]=>
76  int(1234567890)
77  ["path"]=>
78  string(5) "/guff"
79  ["domain"]=>
80  string(3) "foo"
81  ["secure"]=>
82  bool(true)
83  ["httponly"]=>
84  bool(true)
85  ["samesite"]=>
86  string(0) ""
87}
88bool(true)
89array(6) {
90  ["lifetime"]=>
91  int(123)
92  ["path"]=>
93  string(4) "/bar"
94  ["domain"]=>
95  string(3) "baz"
96  ["secure"]=>
97  bool(false)
98  ["httponly"]=>
99  bool(false)
100  ["samesite"]=>
101  string(6) "please"
102}
103Done
104