File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
dev/tests/integration/framework/Magento/TestFramework/TestCase Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -268,10 +268,21 @@ protected function getCookieMessages($messageType = null)
268
268
{
269
269
/** @var $cookieManager CookieManagerInterface */
270
270
$ cookieManager = $ this ->_objectManager ->get (CookieManagerInterface::class);
271
- $ messages = json_decode (
272
- $ cookieManager ->getCookie (MessagePlugin::MESSAGES_COOKIES_NAME , json_encode ([]))
273
- );
274
- if (!is_array ($ messages )) {
271
+
272
+ /** @var $jsonSerializer \Magento\Framework\Serialize\Serializer\Json */
273
+ $ jsonSerializer = $ this ->_objectManager ->get (\Magento \Framework \Serialize \Serializer \Json::class);
274
+ try {
275
+ $ messages = $ jsonSerializer ->unserialize (
276
+ $ cookieManager ->getCookie (
277
+ MessagePlugin::MESSAGES_COOKIES_NAME ,
278
+ $ jsonSerializer ->serialize ([])
279
+ )
280
+ );
281
+
282
+ if (!is_array ($ messages )) {
283
+ $ messages = [];
284
+ }
285
+ } catch (\InvalidArgumentException $ e ) {
275
286
$ messages = [];
276
287
}
277
288
You can’t perform that action at this time.
0 commit comments