[DOC-CVS] [doc-en] master: unserialization: Documented allowed-classes option with enums (#5585)
[email protected] (Volker Dusch via GitHub) Mon, 8 Jun 2026 19:17:15 +0000
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <6C5dJGLQ2svbIRuMyo7cmC1knVQliV1QDvzOIO2Xu2Y@main.internal.php.net> |
Author: Volker Dusch (edorian)
Committer: GitHub (web-flow)
Pusher: jordikroon
Date: 2026-06-08T21:17:12+02:00
Commit: https://github.com/php/doc-en/commit/8af3521cb43f54c652baaf8dbbcb786b79a5d04e
Raw diff: https://github.com/php/doc-en/commit/8af3521cb43f54c652baaf8dbbcb786b79a5d04e.diff
unserialization: Documented allowed-classes option with enums (#5585)
* unserialization: Documented allowed-classes option with enums
Changed paths:
M language/enumerations.xml
M reference/var/functions/unserialize.xml
Diff:
diff --git a/language/enumerations.xml b/language/enumerations.xml
index 840fe9ef2dc8..8a346156ccce 100644
--- a/language/enumerations.xml
+++ b/language/enumerations.xml
@@ -835,6 +835,12 @@ print serialize(Suit::Hearts);
On deserialization, if an enum and case cannot be found to match a serialized
value a warning will be issued and &false; returned.</para>
+ <simpara>
+ The <literal>allowed_classes</literal> option of
+ <function>unserialize</function> does not affect
+ <link linkend="language.enumerations">Enumerations</link>.
+ </simpara>
+
<para>
If a Pure Enum is serialized to JSON, an error will be thrown. If a Backed Enum
is serialized to JSON, it will be represented by its scalar value only, in the
diff --git a/reference/var/functions/unserialize.xml b/reference/var/functions/unserialize.xml
index 0b3128a90124..d43c561a2454 100644
--- a/reference/var/functions/unserialize.xml
+++ b/reference/var/functions/unserialize.xml
@@ -103,6 +103,9 @@
Omitting this option is the same as defining it as &true;: PHP
will attempt to instantiate objects of any class.
</simpara>
+ <simpara>
+ This option does not affect <link linkend="language.enumerations">Enumerations</link>.
+ </simpara>
</entry>
</row>
<row>