You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,7 @@ protected function getCasters(): array
86
86
87
87
publicfunction__serialize(): array
88
88
{
89
-
if (self::class === (new \ReflectionMethod($this, '__sleep'))->class) {
89
+
if (self::class === (new \ReflectionMethod($this, '__sleep'))->class || self::class !== (new \ReflectionMethod($this, '__serialize'))->class) {
90
90
return ['data' => $this->data];
91
91
}
92
92
@@ -108,7 +108,7 @@ public function __serialize(): array
108
108
109
109
publicfunction__unserialize(array$data): void
110
110
{
111
-
if ($wakeup = self::class !== (new \ReflectionMethod($this, '__wakeup'))->class) {
111
+
if ($wakeup = self::class !== (new \ReflectionMethod($this, '__wakeup'))->class && self::class === (new \ReflectionMethod($this, '__unserialize'))->class) {
112
112
trigger_deprecation('symfony/http-kernel', '7.4', 'Implementing "%s::__wakeup()" is deprecated, use "__unserialize()" instead.', get_debug_type($this));
Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Kernel.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -777,7 +777,7 @@ private function preBoot(): ContainerInterface
777
777
778
778
publicfunction__serialize(): array
779
779
{
780
-
if (self::class === (new \ReflectionMethod($this, '__sleep'))->class) {
780
+
if (self::class === (new \ReflectionMethod($this, '__sleep'))->class || self::class !== (new \ReflectionMethod($this, '__serialize'))->class) {
781
781
return [
782
782
'environment' => $this->environment,
783
783
'debug' => $this->debug,
@@ -802,7 +802,7 @@ public function __serialize(): array
802
802
803
803
publicfunction__unserialize(array$data): void
804
804
{
805
-
if ($wakeup = self::class !== (new \ReflectionMethod($this, '__wakeup'))->class) {
805
+
if ($wakeup = self::class !== (new \ReflectionMethod($this, '__wakeup'))->class && self::class === (new \ReflectionMethod($this, '__unserialize'))->class) {
806
806
trigger_deprecation('symfony/http-kernel', '7.4', 'Implementing "%s::__wakeup()" is deprecated, use "__unserialize()" instead.', get_debug_type($this));
Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Part/AbstractPart.php
+51Lines changed: 51 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -62,4 +62,55 @@ abstract public function bodyToIterable(): iterable;
62
62
abstractpublicfunctiongetMediaType(): string;
63
63
64
64
abstractpublicfunctiongetMediaSubtype(): string;
65
+
66
+
publicfunction__serialize(): array
67
+
{
68
+
if (!method_exists($this, '__sleep')) {
69
+
return ['headers' => $this->headers];
70
+
}
71
+
72
+
trigger_deprecation('symfony/mime', '7.4', 'Implementing "%s::__sleep()" is deprecated, use "__serialize()" instead.', get_debug_type($this));
73
+
74
+
$data = [];
75
+
foreach ($this->__sleep() as$key) {
76
+
try {
77
+
if (($r = new \ReflectionProperty($this, $key))->isInitialized($this)) {
78
+
$data[$key] = $r->getValue($this);
79
+
}
80
+
} catch (\ReflectionException) {
81
+
$data[$key] = $this->$key;
82
+
}
83
+
}
84
+
85
+
return$data;
86
+
}
87
+
88
+
publicfunction__unserialize(array$data): void
89
+
{
90
+
if ($wakeup = method_exists($this, '__wakeup') && self::class === (new \ReflectionMethod($this, '__unserialize'))->class) {
91
+
trigger_deprecation('symfony/mime', '7.4', 'Implementing "%s::__wakeup()" is deprecated, use "__unserialize()" instead.', get_debug_type($this));
92
+
}
93
+
94
+
if (['headers'] === array_keys($data)) {
95
+
$this->headers = $data['headers'];
96
+
97
+
if ($wakeup) {
98
+
$this->__wakeup();
99
+
}
100
+
101
+
return;
102
+
}
103
+
104
+
trigger_deprecation('symfony/mime', '7.4', 'Passing more than just key "headers" to "%s::__unserialize()" is deprecated, populate properties in "%s::__unserialize()" instead.', self::class, get_debug_type($this));
Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Part/DataPart.php
+82-1Lines changed: 82 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@
19
19
*/
20
20
class DataPart extends TextPart
21
21
{
22
-
/** @internal */
22
+
/** @internal, to be removed in 8.0 */
23
23
protectedarray$_parent;
24
24
25
25
private ?string$filename = null;
@@ -129,8 +129,86 @@ private function generateContentId(): string
129
129
returnbin2hex(random_bytes(16)).'@symfony';
130
130
}
131
131
132
+
publicfunction__serialize(): array
133
+
{
134
+
if (self::class === (new \ReflectionMethod($this, '__sleep'))->class || self::class !== (new \ReflectionMethod($this, '__serialize'))->class) {
135
+
$parent = parent::__serialize();
136
+
$headers = $parent['_headers'];
137
+
unset($parent['_headers']);
138
+
139
+
return [
140
+
'_headers' => $headers,
141
+
'_parent' => $parent,
142
+
'filename' => $this->filename,
143
+
'mediaType' => $this->mediaType,
144
+
];
145
+
}
146
+
147
+
trigger_deprecation('symfony/mime', '7.4', 'Implementing "%s::__sleep()" is deprecated, use "__serialize()" instead.', get_debug_type($this));
148
+
149
+
$data = [];
150
+
foreach ($this->__sleep() as$key) {
151
+
try {
152
+
if (($r = new \ReflectionProperty($this, $key))->isInitialized($this)) {
153
+
$data[$key] = $r->getValue($this);
154
+
}
155
+
} catch (\ReflectionException) {
156
+
$data[$key] = $this->$key;
157
+
}
158
+
}
159
+
160
+
return$data;
161
+
}
162
+
163
+
publicfunction__unserialize(array$data): void
164
+
{
165
+
if ($wakeup = self::class !== (new \ReflectionMethod($this, '__wakeup'))->class && self::class === (new \ReflectionMethod($this, '__unserialize'))->class) {
166
+
trigger_deprecation('symfony/mime', '7.4', 'Implementing "%s::__wakeup()" is deprecated, use "__unserialize()" instead.', get_debug_type($this));
167
+
}
168
+
169
+
if (['_headers', '_parent', 'filename', 'mediaType'] === array_keys($data)) {
trigger_deprecation('symfony/mime', '7.4', 'Passing extra keys to "%s::__unserialize()" is deprecated, populate properties in "%s::__unserialize()" instead.', self::class, get_debug_type($this));
Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Part/MessagePart.php
+65Lines changed: 65 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -57,13 +57,78 @@ public function bodyToIterable(): iterable
57
57
return$this->message->toIterable();
58
58
}
59
59
60
+
publicfunction__serialize(): array
61
+
{
62
+
if (self::class === (new \ReflectionMethod($this, '__sleep'))->class || self::class !== (new \ReflectionMethod($this, '__serialize'))->class) {
63
+
return ['message' => $this->message];
64
+
}
65
+
66
+
trigger_deprecation('symfony/mime', '7.4', 'Implementing "%s::__sleep()" is deprecated, use "__serialize()" instead.', get_debug_type($this));
67
+
68
+
$data = [];
69
+
foreach ($this->__sleep() as$key) {
70
+
try {
71
+
if (($r = new \ReflectionProperty($this, $key))->isInitialized($this)) {
72
+
$data[$key] = $r->getValue($this);
73
+
}
74
+
} catch (\ReflectionException) {
75
+
$data[$key] = $this->$key;
76
+
}
77
+
}
78
+
79
+
return$data;
80
+
}
81
+
82
+
publicfunction__unserialize(array$data): void
83
+
{
84
+
if ($wakeup = self::class !== (new \ReflectionMethod($this, '__wakeup'))->class && self::class === (new \ReflectionMethod($this, '__unserialize'))->class) {
85
+
trigger_deprecation('symfony/mime', '7.4', 'Implementing "%s::__wakeup()" is deprecated, use "__unserialize()" instead.', get_debug_type($this));
86
+
}
87
+
88
+
if (\in_array(array_keys($data), [['message'], ["\0".self::class."\0message"]], true)) {
trigger_deprecation('symfony/mime', '7.4', 'Passing more than just key "message" to "%s::__unserialize()" is deprecated, populate properties in "%s::__unserialize()" instead.', self::class, get_debug_type($this));
0 commit comments