Description
Description
Due to its broken behavior, PHP is phasing out the Serializable
interface currently.
See:
- https://wiki.php.net/rfc/custom_object_serialization
- https://wiki.php.net/rfc/phase_out_serializable
The replacement are the magic methods __serialize()
and __unserialize()
that have been introduced with PHP 7.4. As long as our implementations of Serializable
also implement those methods, PHP 8.1 won't throw deprecation notices at us. As far as I can tell, we're safe here.
For Symfony 6, we decided to not provide support for PHP 7 anymore. This also means that we don't need Serializable
as a BC layer for PHP 7.3 and below anymore. Because of that, I'd like to propose to remove that interface from all Symfony classes in 6.0.
Affected by this change:
- Mime:
RawMessage
(the implementation of the interface is finalized and flagged@internal
) - Routing:
CompiledRoute
andRoute
both implement the interface with@internal
andfinal
. - Security Core:
TokenInterface
extendsSerializable
but also requires__serialize()
and__unserialize()
to be implemented.AbstractToken
provides an implementation that is again@internal
andfinal
.NullToken
implementsSerializable
without@internal
andfinal
.
Question now is: Do we need any additional deprecation layer for 5.4 or would it be okay to simply unannounce the interface and remove the implementations?