PhpNativeSerializer
in package
implements
MessageSerializer
Read onlyYes
FinalYes
Tags
Table of Contents
Interfaces
Methods
- __construct() : mixed
- deserialize() : object
- Deserializes a string representation back into a message object.
- forTrustedData() : self
- Allow-any deserialization for data that never crossed a trust boundary.
- serialize() : string
- Serializes a message object to a string representation.
Methods
__construct()
public
__construct(array<int, class-string>|null $allowedClasses) : mixed
Parameters
- $allowedClasses : array<int, class-string>|null
-
Classes permitted to be instantiated during deserialization, at any depth of the graph. Pass the explicit allow-list; use forTrustedData() instead of null for the allow-any trusted-data opt-in.
deserialize()
Deserializes a string representation back into a message object.
public
deserialize(string $data, string $type) : object
Parameters
- $data : string
- $type : string
Tags
Attributes
- #[NoDiscard]
- #[Override]
Return values
objectforTrustedData()
Allow-any deserialization for data that never crossed a trust boundary.
public
static forTrustedData() : self
Explicit opt-in: only use when the application itself produced the serialized bytes and stores them where no attacker or operator can influence rows (CWE-502 — gadget chains become RCE otherwise).
Return values
selfserialize()
Serializes a message object to a string representation.
public
serialize(object $message) : string
Parameters
- $message : object
Tags
Attributes
- #[NoDiscard]
- #[Override]