Skip to content

Navigation Menu

Sign in
Appearance settings

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 a2d1e80

Browse filesBrowse files
feature #41299 Remove Serializable implementations (derrabus)
This PR was merged into the 6.0 branch. Discussion ---------- Remove Serializable implementations | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #41094 | License | MIT | Doc PR | N/A Commits ------- 3396915 Remove Serializable implementations
2 parents 9ab26f3 + 3396915 commit a2d1e80
Copy full SHA for a2d1e80

File tree

16 files changed

+19
-100
lines changed
Filter options

16 files changed

+19
-100
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/CompiledRoute.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/CompiledRoute.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __serialize(): array
6868
*/
6969
final public function serialize(): string
7070
{
71-
return serialize($this->__serialize());
71+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
7272
}
7373

7474
public function __unserialize(array $data): void

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Route.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function __serialize(): array
8282
*/
8383
final public function serialize(): string
8484
{
85-
return serialize($this->__serialize());
85+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
8686
}
8787

8888
public function __unserialize(array $data): void

‎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
+2-2Lines changed: 2 additions & 2 deletions
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-
abstract class AbstractToken implements TokenInterface
24+
abstract class AbstractToken implements TokenInterface, \Serializable
2525
{
2626
private $user;
2727
private $roleNames = [];
@@ -264,7 +264,7 @@ public function __toString()
264264
*/
265265
final public function serialize(): string
266266
{
267-
return serialize($this->__serialize());
267+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
268268
}
269269

270270
/**

‎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
+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+
* `TokenInterface` does not extend `Serializable` anymore
8+
49
5.3
510
---
611

‎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.