Skip to content

unserialization: Documented allowed-classes option with enums#5585

Open
edorian wants to merge 1 commit into
php:masterfrom
edorian:document-unserialize-enum-allowed-classes
Open

unserialization: Documented allowed-classes option with enums#5585
edorian wants to merge 1 commit into
php:masterfrom
edorian:document-unserialize-enum-allowed-classes

Conversation

@edorian
Copy link
Copy Markdown
Member

@edorian edorian commented May 26, 2026

Following the discussion in php/php-src#22059

As enums are technically classes, and the allowed-classes option set to "false" does not affect them this piece of clarification should help document the expected (and current) behavior.

Comment thread language/enumerations.xml

<para>
The <literal>allowed_classes</literal> option of
<function>unserialize</function> does not affect enums.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<function>unserialize</function> does not affect enums.
<function>unserialize</function> does not affect <link linkend="language.enumerations">Enumerations</link>.

And ditto in the other file.

Comment thread language/enumerations.xml
value a warning will be issued and &false; returned.</para>

<para>
The <literal>allowed_classes</literal> option of
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The <literal>allowed_classes</literal> option of
The <literal>"allowed_classes"</literal> option of

Not sure about this one, but <literal> feels like it should be combined with "". Perhaps check if there's precedent.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't really a policy for this. It is done, but sometimes.. and mostly for cases like "0" not really for options or arguments. So I am more leaning towards omitting in this specific case.

Copy link
Copy Markdown
Member

@jordikroon jordikroon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor nit; Simpara should be used here too.

Comment thread language/enumerations.xml
On deserialization, if an enum and case cannot be found to match a serialized
value a warning will be issued and &false; returned.</para>

<para>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
<simpara>

Comment thread language/enumerations.xml
<para>
The <literal>allowed_classes</literal> option of
<function>unserialize</function> does not affect enums.
</para>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</para>
</simpara>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants