[doc-en] master: Fix setcookie() documentation for invalid options in PHP 8.0+ (#5104)
| From: | Louis-Arnaud via GitHub | Date: | Fri, 30 Jan 2026 10:06:52 +0000 |
| Subject: | [doc-en] master: Fix setcookie() documentation for invalid options in PHP 8.0+ (#5104) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23103@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-01-30T10:06:50Z
Commit: https://github.com/php/doc-en/commit/b41e78e6237f3fd9bcdaff42b98954b8fe40e5fe
Raw diff: https://github.com/php/doc-en/commit/b41e78e6237f3fd9bcdaff42b98954b8fe40e5fe.diff
Fix setcookie() documentation for invalid options in PHP 8.0+ (#5104)
And move it to the usual dedicated Errors/Exception section
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Changed paths:
M reference/network/functions/setcookie.xml
Diff:
diff --git a/reference/network/functions/setcookie.xml b/reference/network/functions/setcookie.xml
index 3e563e5278c3..75ecb171a7a9 100644
--- a/reference/network/functions/setcookie.xml
+++ b/reference/network/functions/setcookie.xml
@@ -158,8 +158,9 @@
An associative <type>array</type> which may have any of the keys
<literal>expires</literal>, <literal>path</literal>,
<literal>domain</literal>,
<literal>secure</literal>, <literal>httponly</literal> and
<literal>samesite</literal>.
- If any other key is present an error of level <constant>E_WARNING</constant>
- is generated. The values have the same meaning as described for the
+ </simpara>
+ <simpara>
+ The values have the same meaning as described for the
parameters with the same name. The value of the <literal>samesite</literal>
element should be either <literal>None</literal>,
<literal>Lax</literal>
or <literal>Strict</literal>.
@@ -168,6 +169,7 @@
<literal>samesite</literal> element is omitted, no SameSite cookie
attribute is set.
</simpara>
+
<note>
<simpara>
To set a cookie that includes attributes that aren't among the keys listed,
@@ -197,6 +199,25 @@
</simpara>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ If the <parameter>options</parameter> array contains unsupported keys:
+ </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ Prior to PHP 8.0.0, an <constant>E_WARNING</constant> was generated.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ As of PHP 8.0.0, a <exceptionname>ValueError</exceptionname> is thrown.
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </refsect1>
+
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
@@ -223,6 +244,14 @@
SameSite cookie attribute.
</entry>
</row>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ Passing unsupported keys now throws a <exceptionname>ValueError</exceptionname>
+ instead of emitting an <constant>E_WARNING</constant>.
+ </entry>
+ </row>
+
</tbody>
</tgroup>
</informaltable>