[doc-en] master: ext/session: document the 8.4.0 INI deprecations, drop the removed hash_function recommendation (#5800)
| From: | Louis-Arnaud via GitHub | Date: | Mon, 31 Aug 2026 09:55:49 +0000 |
| Subject: | [doc-en] master: ext/session: document the 8.4.0 INI deprecations, drop the removed hash_function recommendation (#5800) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23673@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-08-31T11:55:46+02:00
Commit: https://github.com/php/doc-en/commit/35cadcfe561fc27ee973457a64880f0b85db2ec5
Raw diff: https://github.com/php/doc-en/commit/35cadcfe561fc27ee973457a64880f0b85db2ec5.diff
ext/session: document the 8.4.0 INI deprecations, drop the removed hash_function recommendation
(#5800)
The 8.4.0 session INI deprecations are conditional: PHP only emits
E_DEPRECATED when a setting is moved away from its default value, so the
wording says "changing" / "enabling" / "setting a non-empty value"
rather
than describing the settings themselves as deprecated.
reference/session/ini.xml
- session.sid_length and session.sid_bits_per_character: add the
deprecation as a <warning>, placed before the availability <note> like
the neighbouring entries
- drop the advice to pick a non-default value ("At least 32 chars are
recommended", "5 is recommended value for most environments"), which the
deprecation contradicts
- drop the session.sid_length compatibility tip: it only maps values onto
session.hash_function and session.hash_bits_per_character, both removed
in PHP 7.1.0, and every value it suggests is now deprecated
- align the two summary table rows with the same wording
reference/session/security.xml
- add the deprecation warnings for session.use_trans_sid,
session.trans_sid_tags, session.trans_sid_hosts and
session.referer_check
- this is a list of hardening recommendations, so state the recommended
value as the default one now that any other value is deprecated
- drop the session.hash_function recommendation, the setting was removed
in PHP 7.1.0
- session.referer_check: fix a sentence fragment, and say what the setting
actually does instead of leaving "it" pointing at session.use_trans_sid
- drop the "(PHP 7.1.0 >=)" markers and spell the header Referer
Sources
- Changing session.sid_length / session.sid_bits_per_character:
https://wiki.php.net/rfc/deprecations_php_8_4#sessionsid_length_and_sessionsid_bits_per_character
ext/session/session.c, OnUpdateSidLength (val != 32) and OnUpdateSidBits
(val != 4)
- use_trans_sid, trans_sid_tags, trans_sid_hosts, referer_check:
https://wiki.php.net/rfc/deprecate-get-post-sessions
ext/session/session.c, OnUpdateUseTransSid (if (*p)) and
OnUpdateRefererCheck (ZSTR_LEN != 0); ext/standard/url_scanner_ex.re,
OnUpdateSessionTags and OnUpdateSessionHosts
- referer_check semantics: ext/session/session.c, php_session_start()
discards the id unless HTTP_REFERER contains the configured value
- session.hash_function removed in PHP 7.1.0: UPGRADING (7.1), "Following
INIs are removed"
Changed paths:
M reference/session/ini.xml
M reference/session/security.xml
Diff:
diff --git a/reference/session/ini.xml b/reference/session/ini.xml
index 0e97a646762d..31894dd13f91 100644
--- a/reference/session/ini.xml
+++ b/reference/session/ini.xml
@@ -164,13 +164,19 @@
<entry><link
linkend="ini.session.sid-length">session.sid_length</link></entry>
<entry>"32"</entry>
<entry><constant>INI_ALL</constant></entry>
- <entry>Available as of PHP 7.1.0. Deprecated as of PHP 8.4.0.</entry>
+ <entry>
+ Available as of PHP 7.1.0.
+ Changing this setting is deprecated as of PHP 8.4.0.
+ </entry>
</row>
<row>
<entry><link
linkend="ini.session.sid-bits-per-character">session.sid_bits_per_character</link></entry>
<entry>"4"</entry>
<entry><constant>INI_ALL</constant></entry>
- <entry>Available as of PHP 7.1.0. Deprecated as of PHP 8.4.0.</entry>
+ <entry>
+ Available as of PHP 7.1.0.
+ Changing this setting is deprecated as of PHP 8.4.0.
+ </entry>
</row>
<row>
<entry><link
linkend="ini.session.upload-progress.enabled">session.upload_progress.enabled</link></entry>
@@ -838,30 +844,17 @@
to 256.
</simpara>
<simpara>
- The default is 32. If you need compatibility you may specify 32,
- 40, etc. Longer session ID is harder to guess. At least 32 chars
- are recommended.
+ The default is 32. A longer session ID is harder to guess.
</simpara>
- <tip>
- <para>
- Compatibility Note: Use 32 instead of
- <literal>session.hash_function</literal>=0 (MD5) and
- <literal>session.hash_bits_per_character</literal>=4,
- <literal>session.hash_function</literal>=1 (SHA1) and
- <literal>session.hash_bits_per_character</literal>=6. Use 26 instead of
- <literal>session.hash_function</literal>=0 (MD5) and
- <literal>session.hash_bits_per_character</literal>=5. Use 22 instead of
- <literal>session.hash_function</literal>=0 (MD5) and
- <literal>session.hash_bits_per_character</literal>=6. You must
- configure INI values to have at least 128 bits in session ID. Do
- not forget to set an appropriate value for
- <literal>session.sid_bits_per_character</literal>, otherwise you
- will have weaker session ID.
- </para>
- </tip>
+ <warning>
+ <simpara>
+ Changing <literal>session.sid_length</literal> from its default
+ value is deprecated as of PHP 8.4.0.
+ </simpara>
+ </warning>
<note>
<simpara>
- This setting is introduced in PHP 7.1.0.
+ Available as of PHP 7.1.0.
</simpara>
</note>
</listitem>
@@ -879,14 +872,17 @@
'4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z,
"-", ",").
</simpara>
<simpara>
- The default is 4. The more bits results in stronger session ID. 5 is
- recommended value for most environments.
+ The default is 4. More bits result in a stronger session ID.
</simpara>
- <para>
- </para>
+ <warning>
+ <simpara>
+ Changing <literal>session.sid_bits_per_character</literal> from its
+ default value is deprecated as of PHP 8.4.0.
+ </simpara>
+ </warning>
<note>
<simpara>
- This setting is introduced in PHP 7.1.0.
+ Available as of PHP 7.1.0.
</simpara>
</note>
</listitem>
diff --git a/reference/session/security.xml b/reference/session/security.xml
index ac1927417787..b4d927ac9285 100644
--- a/reference/session/security.xml
+++ b/reference/session/security.xml
@@ -649,12 +649,16 @@
<para>
<link
linkend="ini.session.use-trans-sid">session.use_trans_sid</link>=Off
</para>
- <para>
- Use of a transparent session ID management is not prohibited.
- Developers may employ it when it is required.
- However, disabling transparent session ID management improves the general session
+ <simpara>
+ Disabling transparent session ID management improves the general session
ID security by eliminating the possibility of a session ID injection and/or leak.
- </para>
+ </simpara>
+ <warning>
+ <simpara>
+ Enabling <literal>session.use_trans_sid</literal> is deprecated
+ as of PHP 8.4.0.
+ </simpara>
+ </warning>
<note>
<para>
Session ID may leak from bookmarked URLs, e-mailed URLs, saved HTML source, etc.
@@ -663,45 +667,62 @@
</listitem>
<listitem>
- <para>
- <link
linkend="ini.session.trans-sid-tags">session.trans_sid_tags</link>=[limited tags]
- </para>
- <para>
- (PHP 7.1.0 >=) Developers should not rewrite unneeded HTML tags.
- Default value should be sufficient for most usages.
+ <simpara>
+ <link
linkend="ini.session.trans-sid-tags">session.trans_sid_tags</link>="a=href,area=href,frame=src,form="
+ </simpara>
+ <simpara>
+ Unneeded HTML tags should not be rewritten.
+ The default value is sufficient for most usages.
Older PHP versions use
<link linkend="ini.url-rewriter.tags">url_rewriter.tags</link> instead.
- </para>
+ </simpara>
+ <warning>
+ <simpara>
+ Changing <literal>session.trans_sid_tags</literal> from its default
+ value is deprecated as of PHP 8.4.0.
+ </simpara>
+ </warning>
</listitem>
<listitem>
- <para>
- <link
linkend="ini.session.trans-sid-hosts">session.trans_sid_hosts</link>=[limited
hosts]
- </para>
- <para>
- (PHP 7.1.0 >=) This INI defines whitelist hosts that allows trans sid rewrite.
- Never add untrusted hosts.
- Session module only allows <literal>$_SERVER['HTTP_HOST']</literal>
- when this setting is empty.
- </para>
+ <simpara>
+ <link
linkend="ini.session.trans-sid-hosts">session.trans_sid_hosts</link>=""
+ </simpara>
+ <simpara>
+ This setting lists the hosts for which the session ID may be added
+ to URLs. Untrusted hosts must never be added.
+ When it is empty, the session module only allows
+ <literal>$_SERVER['HTTP_HOST']</literal>.
+ </simpara>
+ <warning>
+ <simpara>
+ Setting <literal>session.trans_sid_hosts</literal> to a non-empty
+ value is deprecated as of PHP 8.4.0.
+ </simpara>
+ </warning>
</listitem>
<listitem>
- <para>
- <link
linkend="ini.session.referer-check">session.referer_check</link>=[originating
URL]
- </para>
- <para>
+ <simpara>
+ <link
linkend="ini.session.referer-check">session.referer_check</link>=""
+ </simpara>
+ <simpara>
When <link
linkend="ini.session.use-trans-sid">session.use_trans_sid</link>
- is enabled.
- It reduces the risk of session ID injection.
- If a website is <literal>http://example.com/</literal>,
- set <literal>http://example.com/</literal> to it.
- Note that with HTTPS browsers will not send the referrer header.
- Browsers may not send the referrer header by configuration.
+ is enabled, a non-empty value reduces the risk of session ID
+ injection: the session ID sent by the client is discarded unless the
+ <literal>Referer</literal> header contains that value.
+ Note that with HTTPS browsers will not send the
+ <literal>Referer</literal> header, and browsers may omit it by
+ configuration.
Therefore, this setting is not a reliable security measure.
- Use of this setting is recommended.
- </para>
+ </simpara>
+ <warning>
+ <simpara>
+ Setting <literal>session.referer_check</literal> to a non-empty
+ value is deprecated as of PHP 8.4.0.
+ </simpara>
+ </warning>
</listitem>
<listitem>
@@ -721,20 +742,6 @@
</para>
</listitem>
- <listitem>
- <para>
- <link
linkend="ini.session.hash-function">session.hash_function</link>="sha256"
- </para>
- <para>
- (PHP 7.1.0 <) A stronger hash function will generate a stronger session ID.
- Although hash collision is unlikely even with the MD5 hashing algorithm,
- developers should use SHA-2 or a stronger hashing algorithm like sha384 and sha512.
- Developers must ensure they feed a long enough
- <link linkend="ini.session.entropy-length">entropy</link>
- for the hashing function used.
- </para>
- </listitem>
-
<listitem>
<para>
<link linkend="ini.session.save-path">session.save_path</link>=[non
world-readable directory]