From d32a29527b582ad88b5c24f38c1680100ace4546 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Wed, 5 Jun 2019 11:11:58 +0200 Subject: [PATCH] [Routing] revert deprecation of Serializable in routing we still need to implement Serializable as long as we support PHP < 7.4. otherwise serialized data in php 7.2 would not work anymore when people upgrade to php 7.4 --- UPGRADE-4.3.md | 5 +++-- UPGRADE-5.0.md | 5 +++-- src/Symfony/Component/Routing/CHANGELOG.md | 5 +++-- src/Symfony/Component/Routing/CompiledRoute.php | 6 ++++-- src/Symfony/Component/Routing/Route.php | 6 ++++-- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/UPGRADE-4.3.md b/UPGRADE-4.3.md index a2ea3f2871..531a8e61b9 100644 --- a/UPGRADE-4.3.md +++ b/UPGRADE-4.3.md @@ -121,8 +121,9 @@ Routing * The `generator_base_class`, `generator_cache_class`, `matcher_base_class`, and `matcher_cache_class` router options have been deprecated. - * Implementing `Serializable` for `Route` and `CompiledRoute` is deprecated; if you serialize them, please - ensure your unserialization logic can recover from a failure related to an updated serialization format + * `Serializable` implementing methods for `Route` and `CompiledRoute` are marked as `@internal` and `@final`. + Instead of overwriting them, use `__serialize` and `__unserialize` as extension points which are forward compatible + with the new serialization methods in PHP 7.4. Security -------- diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index 6f71eb546c..c2abf4f8b7 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -282,8 +282,9 @@ Routing * The `generator_base_class`, `generator_cache_class`, `matcher_base_class`, and `matcher_cache_class` router options have been removed. - * `Route` and `CompiledRoute` don't implement `Serializable` anymore; if you serialize them, please - ensure your unserialization logic can recover from a failure related to an updated serialization format + * `Serializable` implementing methods for `Route` and `CompiledRoute` are final. + Instead of overwriting them, use `__serialize` and `__unserialize` as extension points which are forward compatible + with the new serialization methods in PHP 7.4. Security -------- diff --git a/src/Symfony/Component/Routing/CHANGELOG.md b/src/Symfony/Component/Routing/CHANGELOG.md index f7439903e0..05ae44b5f1 100644 --- a/src/Symfony/Component/Routing/CHANGELOG.md +++ b/src/Symfony/Component/Routing/CHANGELOG.md @@ -8,8 +8,9 @@ CHANGELOG * added `CompiledUrlGenerator` and `CompiledUrlGeneratorDumper` * deprecated `PhpGeneratorDumper` and `PhpMatcherDumper` * deprecated `generator_base_class`, `generator_cache_class`, `matcher_base_class` and `matcher_cache_class` router options - * deprecated implementing `Serializable` for `Route` and `CompiledRoute`; if you serialize them, please - ensure your unserialization logic can recover from a failure related to an updated serialization format + * `Serializable` implementing methods for `Route` and `CompiledRoute` are marked as `@internal` and `@final`. + Instead of overwriting them, use `__serialize` and `__unserialize` as extension points which are forward compatible + with the new serialization methods in PHP 7.4. * exposed `utf8` Route option, defaults "locale" and "format" in configuration loaders and configurators * added support for invokable route loader services diff --git a/src/Symfony/Component/Routing/CompiledRoute.php b/src/Symfony/Component/Routing/CompiledRoute.php index 06dc87d740..87278e702a 100644 --- a/src/Symfony/Component/Routing/CompiledRoute.php +++ b/src/Symfony/Component/Routing/CompiledRoute.php @@ -64,7 +64,8 @@ class CompiledRoute implements \Serializable } /** - * @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore + * @internal since Symfony 4.3 + * @final since Symfony 4.3 */ public function serialize() { @@ -84,7 +85,8 @@ class CompiledRoute implements \Serializable } /** - * @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore + * @internal since Symfony 4.3 + * @final since Symfony 4.3 */ public function unserialize($serialized) { diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php index 178c5d3ac2..90d8e617c4 100644 --- a/src/Symfony/Component/Routing/Route.php +++ b/src/Symfony/Component/Routing/Route.php @@ -78,7 +78,8 @@ class Route implements \Serializable } /** - * @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore + * @internal since Symfony 4.3 + * @final since Symfony 4.3 */ public function serialize() { @@ -104,7 +105,8 @@ class Route implements \Serializable } /** - * @internal since Symfony 4.3, will be removed in Symfony 5 as the class won't implement Serializable anymore + * @internal since Symfony 4.3 + * @final since Symfony 4.3 */ public function unserialize($serialized) {