File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Tests/Transport/Serialization Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ public function testDecodingFailsWithBadClass()
5858 $ serializer = new PhpSerializer ();
5959
6060 $ serializer ->decode ([
61- 'body ' => 'O:13:"ReceivedSt0mp":0:{} ' ,
61+ 'body ' => base64_encode ( 'O:13:"ReceivedSt0mp":0:{} ' ) ,
6262 ]);
6363 }
6464}
Original file line number Diff line number Diff line change @@ -30,7 +30,13 @@ public function decode(array $encodedEnvelope): Envelope
3030 throw new MessageDecodingFailedException ('Encoded envelope should have at least a "body". ' );
3131 }
3232
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 );
3440 }
3541
3642 /**
@@ -39,7 +45,7 @@ public function decode(array $encodedEnvelope): Envelope
3945 public function encode (Envelope $ envelope ): array
4046 {
4147 return [
42- 'body ' => serialize ($ envelope ),
48+ 'body ' => base64_encode ( serialize ($ envelope) ),
4349 ];
4450 }
4551
You can’t perform that action at this time.
0 commit comments