reference/session/functions/session-set-cookie-params.xml
37be0e0626e8b96e617e800392651eacc5f65bdc
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.session-set-cookie-params">
3
+
<refentry xml:id="function.session-set-cookie-params" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>session_set_cookie_params</refname>
6
6
<refpurpose>Set the session cookie parameters</refpurpose>
...
...
@@ -9,12 +9,17 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>void</type><methodname>session_set_cookie_params</methodname>
13
-
<methodparam><type>int</type><parameter>lifetime</parameter></methodparam>
14
-
<methodparam choice="opt"><type>string</type><parameter>path</parameter></methodparam>
15
-
<methodparam choice="opt"><type>string</type><parameter>domain</parameter></methodparam>
16
-
<methodparam choice="opt"><type>bool</type><parameter>secure</parameter><initializer>false</initializer></methodparam>
17
-
<methodparam choice="opt"><type>bool</type><parameter>httponly</parameter><initializer>false</initializer></methodparam>
12
+
<type>bool</type><methodname>session_set_cookie_params</methodname>
13
+
<methodparam><type>int</type><parameter>lifetime_or_options</parameter></methodparam>
14
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>path</parameter><initializer>&null;</initializer></methodparam>
15
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>domain</parameter><initializer>&null;</initializer></methodparam>
16
+
<methodparam choice="opt"><type class="union"><type>bool</type><type>null</type></type><parameter>secure</parameter><initializer>&null;</initializer></methodparam>
17
+
<methodparam choice="opt"><type class="union"><type>bool</type><type>null</type></type><parameter>httponly</parameter><initializer>&null;</initializer></methodparam>
18
+
</methodsynopsis>
19
+
<para>Alternative signature available as of PHP 7.3.0:</para>
20
+
<methodsynopsis>
21
+
<type>bool</type><methodname>session_set_cookie_params</methodname>
22
+
<methodparam><type>array</type><parameter>lifetime_or_options</parameter></methodparam>
18
23
</methodsynopsis>
19
24
<para>
20
25
Set cookie parameters defined in the &php.ini; file. The effect of this
...
...
@@ -33,12 +38,25 @@
33
38
<para>
34
39
<variablelist>
35
40
<varlistentry>
36
-
<term><parameter>lifetime</parameter></term>
41
+
<term><parameter>lifetime_or_options</parameter></term>
37
42
<listitem>
38
43
<para>
39
-
<link linkend="ini.session.cookie-lifetime">Lifetime</link> of the
44
+
When using the first signature, <link linkend="ini.session.cookie-lifetime">lifetime</link> of the
40
45
session cookie, defined in seconds.
41
46
</para>
47
+
<para>
48
+
When using the second signature,
49
+
an associative <type>array</type> which may have any of the keys
50
+
<literal>lifetime</literal>, <literal>path</literal>, <literal>domain</literal>,
51
+
<literal>secure</literal>, <literal>httponly</literal> and <literal>samesite</literal>.
52
+
The values have the same meaning as described for the parameters with the
53
+
same name. The value of the <literal>samesite</literal> element should be
54
+
either <literal>Lax</literal> or <literal>Strict</literal>.
55
+
If any of the allowed options are not given, their default values are the
56
+
same as the default values of the explicit parameters. If the
57
+
<literal>samesite</literal> element is omitted, no SameSite cookie
58
+
attribute is set.
59
+
</para>
42
60
</listitem>
43
61
</varlistentry>
44
62
<varlistentry>
...
...
@@ -87,7 +105,7 @@
87
105
<refsect1 role="returnvalues">
88
106
&reftitle.returnvalues;
89
107
<para>
90
-
&return.void;
108
+
&return.success;
91
109
</para>
92
110
</refsect1>
93
111

...
...
@@ -104,9 +122,24 @@
104
122
</thead>
105
123
<tbody>
106
124
<row>
107
-
<entry>5.2.0</entry>
125
+
<entry>8.0.0</entry>
126
+
<entry>
127
+
<parameter>path</parameter>, <parameter>domain</parameter>,
128
+
<parameter>secure</parameter> and <parameter>httponly</parameter> are nullable now.
129
+
</entry>
130
+
</row>
131
+
<row>
132
+
<entry>7.3.0</entry>
108
133
<entry>
109
-
The <parameter>httponly</parameter> parameter was added.
134
+
An alternative signature supporting an <parameter>lifetime_or_options</parameter>
135
+
&array; has been added. This signature supports also setting of the
136
+
SameSite cookie attribute.
137
+
</entry>
138
+
</row>
139
+
<row>
140
+
<entry>7.2.0</entry>
141
+
<entry>
142
+
&return.success; Formerly the function returned <type>void</type>.
110
143
</entry>
111
144
</row>
112
145
</tbody>
...
...
@@ -134,13 +167,15 @@
134
167
<member>
135
168
<link linkend="ini.session.cookie-httponly">session.cookie_httponly</link>
136
169
</member>
170
+
<member>
171
+
<link linkend="ini.session.cookie-samesite">session.cookie_samesite</link>
172
+
</member>
137
173
<member><function>session_get_cookie_params</function></member>
138
174
</simplelist>
139
175
</para>
140
176
</refsect1>
141
177

142
178
</refentry>
143
-

144
179
<!-- Keep this comment at the end of the file
145
180
Local variables:
146
181
mode: sgml
147
182