Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d6b8605

Browse filesBrowse files
committed
Remove Serializable implementations
1 parent 16f20b2 commit d6b8605
Copy full SHA for d6b8605

File tree

17 files changed

+23
-146
lines changed
Filter options

17 files changed

+23
-146
lines changed

‎src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* This class is a hand written simplified version of PHP native `ArrayObject`
1616
* class, to show that it behaves differently than the PHP native implementation.
1717
*/
18-
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
18+
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable
1919
{
2020
private $array;
2121

@@ -63,18 +63,8 @@ public function __serialize(): array
6363
return $this->array;
6464
}
6565

66-
public function serialize(): string
67-
{
68-
return serialize($this->__serialize());
69-
}
70-
7166
public function __unserialize(array $data): void
7267
{
7368
$this->array = $data;
7469
}
75-
76-
public function unserialize($serialized)
77-
{
78-
$this->__unserialize((array) unserialize((string) $serialized));
79-
}
8070
}

‎src/Symfony/Component/Mime/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Remove `Address::fromString()`, use `Address::create()` instead
8+
* Remove `Serializable` interface from `RawMessage`
89

910
5.2.0
1011
-----

‎src/Symfony/Component/Mime/RawMessage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/RawMessage.php
+1-17Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @author Fabien Potencier <fabien@symfony.com>
1818
*/
19-
class RawMessage implements \Serializable
19+
class RawMessage
2020
{
2121
private $message;
2222

@@ -60,22 +60,6 @@ public function ensureValidity()
6060
{
6161
}
6262

63-
/**
64-
* @internal
65-
*/
66-
final public function serialize(): string
67-
{
68-
return serialize($this->__serialize());
69-
}
70-
71-
/**
72-
* @internal
73-
*/
74-
final public function unserialize($serialized)
75-
{
76-
$this->__unserialize(unserialize($serialized));
77-
}
78-
7963
public function __serialize(): array
8064
{
8165
return [$this->toString()];

‎src/Symfony/Component/PropertyAccess/Tests/Fixtures/NonTraversableArrayObject.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyAccess/Tests/Fixtures/NonTraversableArrayObject.php
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* This class is a hand written simplified version of PHP native `ArrayObject`
1616
* class, to show that it behaves differently than the PHP native implementation.
1717
*/
18-
class NonTraversableArrayObject implements \ArrayAccess, \Countable, \Serializable
18+
class NonTraversableArrayObject implements \ArrayAccess, \Countable
1919
{
2020
private $array;
2121

@@ -58,18 +58,8 @@ public function __serialize(): array
5858
return $this->array;
5959
}
6060

61-
public function serialize(): string
62-
{
63-
return serialize($this->__serialize());
64-
}
65-
6661
public function __unserialize(array $data): void
6762
{
6863
$this->array = $data;
6964
}
70-
71-
public function unserialize($serialized)
72-
{
73-
$this->__unserialize((array) unserialize((string) $serialized));
74-
}
7565
}

‎src/Symfony/Component/PropertyAccess/Tests/Fixtures/TraversableArrayObject.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyAccess/Tests/Fixtures/TraversableArrayObject.php
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* This class is a hand written simplified version of PHP native `ArrayObject`
1616
* class, to show that it behaves differently than the PHP native implementation.
1717
*/
18-
class TraversableArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
18+
class TraversableArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable
1919
{
2020
private $array;
2121

@@ -63,18 +63,8 @@ public function __serialize(): array
6363
return $this->array;
6464
}
6565

66-
public function serialize(): string
67-
{
68-
return serialize($this->__serialize());
69-
}
70-
7166
public function __unserialize(array $data): void
7267
{
7368
$this->array = $data;
7469
}
75-
76-
public function unserialize($serialized)
77-
{
78-
$this->__unserialize((array) unserialize((string) $serialized));
79-
}
8070
}

‎src/Symfony/Component/Routing/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* Remove the `Serializable` interface from `Route` and `CompiledRoute`
8+
49
5.3
510
---
611

‎src/Symfony/Component/Routing/CompiledRoute.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/CompiledRoute.php
+1-17Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Fabien Potencier <fabien@symfony.com>
1818
*/
19-
class CompiledRoute implements \Serializable
19+
class CompiledRoute
2020
{
2121
private $variables;
2222
private $tokens;
@@ -63,14 +63,6 @@ public function __serialize(): array
6363
];
6464
}
6565

66-
/**
67-
* @internal
68-
*/
69-
final public function serialize(): string
70-
{
71-
return serialize($this->__serialize());
72-
}
73-
7466
public function __unserialize(array $data): void
7567
{
7668
$this->variables = $data['vars'];
@@ -83,14 +75,6 @@ public function __unserialize(array $data): void
8375
$this->hostVariables = $data['host_vars'];
8476
}
8577

86-
/**
87-
* @internal
88-
*/
89-
final public function unserialize($serialized)
90-
{
91-
$this->__unserialize(unserialize($serialized, ['allowed_classes' => false]));
92-
}
93-
9478
/**
9579
* Returns the static prefix.
9680
*

‎src/Symfony/Component/Routing/Route.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Route.php
+1-17Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @author Fabien Potencier <fabien@symfony.com>
1818
* @author Tobias Schultze <http://tobion.de>
1919
*/
20-
class Route implements \Serializable
20+
class Route
2121
{
2222
private $path = '/';
2323
private $host = '';
@@ -77,14 +77,6 @@ public function __serialize(): array
7777
];
7878
}
7979

80-
/**
81-
* @internal
82-
*/
83-
final public function serialize(): string
84-
{
85-
return serialize($this->__serialize());
86-
}
87-
8880
public function __unserialize(array $data): void
8981
{
9082
$this->path = $data['path'];
@@ -103,14 +95,6 @@ public function __unserialize(array $data): void
10395
}
10496
}
10597

106-
/**
107-
* @internal
108-
*/
109-
final public function unserialize($serialized)
110-
{
111-
$this->__unserialize(unserialize($serialized));
112-
}
113-
11498
/**
11599
* Returns the pattern for the path.
116100
*

‎src/Symfony/Component/Routing/Tests/RouteTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Tests/RouteTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function testSerializeWhenCompiledWithClass()
299299
*/
300300
public function testSerializedRepresentationKeepsWorking()
301301
{
302-
$serialized = 'C:31:"Symfony\Component\Routing\Route":936:{a:8:{s:4:"path";s:13:"/prefix/{foo}";s:4:"host";s:20:"{locale}.example.net";s:8:"defaults";a:1:{s:3:"foo";s:7:"default";}s:12:"requirements";a:1:{s:3:"foo";s:3:"\d+";}s:7:"options";a:1:{s:14:"compiler_class";s:39:"Symfony\Component\Routing\RouteCompiler";}s:7:"schemes";a:0:{}s:7:"methods";a:0:{}s:8:"compiled";C:39:"Symfony\Component\Routing\CompiledRoute":571:{a:8:{s:4:"vars";a:2:{i:0;s:6:"locale";i:1;s:3:"foo";}s:11:"path_prefix";s:7:"/prefix";s:10:"path_regex";s:31:"{^/prefix(?:/(?P<foo>\d+))?$}sD";s:11:"path_tokens";a:2:{i:0;a:4:{i:0;s:8:"variable";i:1;s:1:"/";i:2;s:3:"\d+";i:3;s:3:"foo";}i:1;a:2:{i:0;s:4:"text";i:1;s:7:"/prefix";}}s:9:"path_vars";a:1:{i:0;s:3:"foo";}s:10:"host_regex";s:40:"{^(?P<locale>[^\.]++)\.example\.net$}sDi";s:11:"host_tokens";a:2:{i:0;a:2:{i:0;s:4:"text";i:1;s:12:".example.net";}i:1;a:4:{i:0;s:8:"variable";i:1;s:0:"";i:2;s:7:"[^\.]++";i:3;s:6:"locale";}}s:9:"host_vars";a:1:{i:0;s:6:"locale";}}}}}';
302+
$serialized = 'O:31:"Symfony\Component\Routing\Route":9:{s:4:"path";s:13:"/prefix/{foo}";s:4:"host";s:20:"{locale}.example.net";s:8:"defaults";a:1:{s:3:"foo";s:7:"default";}s:12:"requirements";a:1:{s:3:"foo";s:3:"\d+";}s:7:"options";a:1:{s:14:"compiler_class";s:39:"Symfony\Component\Routing\RouteCompiler";}s:7:"schemes";a:0:{}s:7:"methods";a:0:{}s:9:"condition";s:0:"";s:8:"compiled";O:39:"Symfony\Component\Routing\CompiledRoute":8:{s:4:"vars";a:2:{i:0;s:6:"locale";i:1;s:3:"foo";}s:11:"path_prefix";s:7:"/prefix";s:10:"path_regex";s:31:"{^/prefix(?:/(?P<foo>\d+))?$}sD";s:11:"path_tokens";a:2:{i:0;a:4:{i:0;s:8:"variable";i:1;s:1:"/";i:2;s:3:"\d+";i:3;s:3:"foo";}i:1;a:2:{i:0;s:4:"text";i:1;s:7:"/prefix";}}s:9:"path_vars";a:1:{i:0;s:3:"foo";}s:10:"host_regex";s:40:"{^(?P<locale>[^\.]++)\.example\.net$}sDi";s:11:"host_tokens";a:2:{i:0;a:2:{i:0;s:4:"text";i:1;s:12:".example.net";}i:1;a:4:{i:0;s:8:"variable";i:1;s:0:"";i:2;s:7:"[^\.]++";i:3;s:6:"locale";}}s:9:"host_vars";a:1:{i:0;s:6:"locale";}}}';
303303
$unserialized = unserialize($serialized);
304304

305305
$route = new Route('/prefix/{foo}', ['foo' => 'default'], ['foo' => '\d+']);

‎src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
-16Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -259,22 +259,6 @@ public function __toString()
259259
return sprintf('%s(user="%s", authenticated=%s, roles="%s")', $class, $this->getUserIdentifier(), json_encode($this->authenticated), implode(', ', $roles));
260260
}
261261

262-
/**
263-
* @internal
264-
*/
265-
final public function serialize(): string
266-
{
267-
return serialize($this->__serialize());
268-
}
269-
270-
/**
271-
* @internal
272-
*/
273-
final public function unserialize($serialized)
274-
{
275-
$this->__unserialize(\is_array($serialized) ? $serialized : unserialize($serialized));
276-
}
277-
278262
private function hasUserChanged(UserInterface $user): bool
279263
{
280264
if (!($this->user instanceof UserInterface)) {

‎src/Symfony/Component/Security/Core/Authentication/Token/NullToken.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Token/NullToken.php
-21Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,25 +100,4 @@ public function __serialize(): array
100100
public function __unserialize(array $data): void
101101
{
102102
}
103-
104-
/**
105-
* @return string
106-
*
107-
* @internal in 5.3
108-
* @final in 5.3
109-
*/
110-
public function serialize()
111-
{
112-
return '';
113-
}
114-
115-
/**
116-
* @return void
117-
*
118-
* @internal in 5.3
119-
* @final in 5.3
120-
*/
121-
public function unserialize($serialized)
122-
{
123-
}
124103
}

‎src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* @author Fabien Potencier <fabien@symfony.com>
2222
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2323
*/
24-
interface TokenInterface extends \Serializable
24+
interface TokenInterface
2525
{
2626
/**
2727
* Returns a string representation of the Token.

‎src/Symfony/Component/Security/Core/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* `TokenInterface` does not extend `Serializable` anymore
8+
* Remove `serialize()` and `unserialize()` from all token implementations
9+
410
5.3
511
---
612

‎src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public function __toString(): string
232232
}
233233
}
234234

235-
class SerializableUser implements UserInterface, \Serializable
235+
class SerializableUser implements UserInterface
236236
{
237237
private $roles;
238238
private $name;
@@ -275,16 +275,6 @@ public function getSalt()
275275
{
276276
return null;
277277
}
278-
279-
public function serialize(): string
280-
{
281-
return serialize($this->name);
282-
}
283-
284-
public function unserialize($serialized): void
285-
{
286-
$this->name = unserialize($serialized);
287-
}
288278
}
289279

290280
class ConcreteToken extends AbstractToken

‎src/Symfony/Component/Security/Core/Tests/Authentication/Token/SwitchUserTokenTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Tests/Authentication/Token/SwitchUserTokenTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function testSerializeNullImpersonateUrl()
9494
/**
9595
* Tests if an old version of SwitchUserToken can still be unserialized.
9696
*
97-
* The fixture was generated by running the following code with Symfony 4.4 and PHP 7.2.
97+
* The fixture was generated by running the following code with Symfony 4.4 and PHP 8.0.
9898
*
9999
* serialize(
100100
* new SwitchUserToken(

‎src/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* This class is a hand written simplified version of PHP native `ArrayObject`
1616
* class, to show that it behaves differently than the PHP native implementation.
1717
*/
18-
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
18+
class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable
1919
{
2020
private $array;
2121

@@ -63,18 +63,8 @@ public function __serialize(): array
6363
return $this->array;
6464
}
6565

66-
public function serialize(): string
67-
{
68-
return serialize($this->__serialize());
69-
}
70-
7166
public function __unserialize(array $data): void
7267
{
7368
$this->array = $data;
7469
}
75-
76-
public function unserialize($serialized)
77-
{
78-
$this->__unserialize((array) unserialize((string) $serialized));
79-
}
8070
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.