reference/session/functions/session-name.xml
c35c07ab6a9cf533455947147634399fc928f6ca
...
...
@@ -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-name">
3
+
<refentry xml:id="function.session-name" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>session_name</refname>
6
6
<refpurpose>Get and/or set the current session name</refpurpose>
...
...
@@ -9,8 +9,8 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>string</type><methodname>session_name</methodname>
13
-
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
12
+
<type class="union"><type>string</type><type>false</type></type><methodname>session_name</methodname>
13
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>name</parameter><initializer>&null;</initializer></methodparam>
14
14
</methodsynopsis>
15
15
<para>
16
16
<function>session_name</function> returns the name of the current
...
...
@@ -19,11 +19,20 @@
19
19
the <emphasis>old</emphasis> session name.
20
20
</para>
21
21
<para>
22
+
If a new session <parameter>name</parameter> is
23
+
supplied, <function>session_name</function> modifies the HTTP cookie
24
+
(and output content when <literal>session.transid</literal> is
25
+
enabled). Once the HTTP cookie is
26
+
sent, <function>session_name</function> raises error.
27
+
<function>session_name</function> must be called
28
+
before <function>session_start</function> for the session to work
29
+
properly.
30
+
</para>
31
+
<para>
22
32
The session name is reset to the default value stored in
23
33
<literal>session.name</literal> at request startup time. Thus, you need to
24
34
call <function>session_name</function> for every request (and before
25
-
<function>session_start</function> or <function>session_register</function>
26
-
are called).
35
+
<function>session_start</function> is called).
27
36
</para>
28
37
</refsect1>
29
38

...
...
@@ -39,7 +48,7 @@
39
48
used in cookies and URLs (e.g. <literal>PHPSESSID</literal>). It
40
49
should contain only alphanumeric characters; it should be short and
41
50
descriptive (i.e. for users with enabled cookie warnings).
42
-
If <parameter>name</parameter> is specified, the name of the current
51
+
If <parameter>name</parameter> is specified and not &null;, the name of the current
43
52
session is changed to its value.
44
53
</para>
45
54
<para>
...
...
@@ -61,7 +70,42 @@
61
70
<para>
62
71
Returns the name of the current session. If <parameter>name</parameter> is given
63
72
and function updates the session name, name of the <emphasis>old</emphasis> session
64
-
is returned.
73
+
is returned, &return.falseforfailure;.
74
+
</para>
75
+
</refsect1>
76
+

77
+
<refsect1 role="changelog">
78
+
&reftitle.changelog;
79
+
<para>
80
+
<informaltable>
81
+
<tgroup cols="2">
82
+
<thead>
83
+
<row>
84
+
<entry>&Version;</entry>
85
+
<entry>&Description;</entry>
86
+
</row>
87
+
</thead>
88
+
<tbody>
89
+
<row>
90
+
<entry>8.0.0</entry>
91
+
<entry>
92
+
<parameter>name</parameter> is nullable now.
93
+
</entry>
94
+
</row>
95
+
<row>
96
+
<entry>7.2.0</entry>
97
+
<entry>
98
+
<function>session_name</function> checks session status,
99
+
previously it only checked cookie status. Therefore,
100
+
older <function>session_name</function> allows to
101
+
call <function>session_name</function>
102
+
after <function>session_start</function> which may crash PHP
103
+
and may result in misbehaviors.
104
+
</entry>
105
+
</row>
106
+
</tbody>
107
+
</tgroup>
108
+
</informaltable>
65
109
</para>
66
110
</refsect1>
67
111

...
...
@@ -99,7 +143,6 @@ echo "The previous session name was $previous_name<br />";
99
143
</refsect1>
100
144

101
145
</refentry>
102
-

103
146
<!-- Keep this comment at the end of the file
104
147
Local variables:
105
148
mode: sgml
106
149