File tree 2 files changed +9
-3
lines changed
src/Symfony/Component/Messenger
Tests/Transport/Serialization
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ public function testDecodingFailsWithBadClass()
58
58
$ serializer = new PhpSerializer ();
59
59
60
60
$ serializer ->decode ([
61
- 'body ' => 'O:13:"ReceivedSt0mp":0:{} ' ,
61
+ 'body ' => base64_encode ( 'O:13:"ReceivedSt0mp":0:{} ' ) ,
62
62
]);
63
63
}
64
64
}
Original file line number Diff line number Diff line change @@ -30,7 +30,13 @@ public function decode(array $encodedEnvelope): Envelope
30
30
throw new MessageDecodingFailedException ('Encoded envelope should have at least a "body". ' );
31
31
}
32
32
33
- return $ this ->safelyUnserialize ($ encodedEnvelope ['body ' ]);
33
+ $ serializeEnvelope = base64_decode ($ encodedEnvelope ['body ' ]);
34
+
35
+ if (false === $ serializeEnvelope ) {
36
+ throw new MessageDecodingFailedException ('The "body" key could not be base64 decoded. ' );
37
+ }
38
+
39
+ return $ this ->safelyUnserialize ($ serializeEnvelope );
34
40
}
35
41
36
42
/**
@@ -39,7 +45,7 @@ public function decode(array $encodedEnvelope): Envelope
39
45
public function encode (Envelope $ envelope ): array
40
46
{
41
47
return [
42
- 'body ' => serialize ($ envelope ),
48
+ 'body ' => base64_encode ( serialize ($ envelope) ),
43
49
];
44
50
}
45
51
You can’t perform that action at this time.
0 commit comments