Skip to content

Commit

Permalink
Fix "Unable to unserialize value" bug
Browse files Browse the repository at this point in the history
  • Loading branch information
thaiphan committed Oct 14, 2018
1 parent 8376b9e commit 742ee30
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Model/MediaStorage/File/Storage/S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ public function init()
/**
* Retrieve Serializer depending the Magento Version
*
* @return bool|\Zend_Serializer|\Magento\Framework\Serialize\Serializer\Serialize
* @return bool|\Zend_Serializer|\Magento\Framework\Serialize\Serializer\Json
*/
protected function getSerializer()
{
// Magento Version 2.1.*
$serializer = \Zend\Serializer\Serializer::factory(\Zend\Serializer\Adapter\PhpSerialize::class);
$serializer = \Zend\Serializer\Serializer::factory(\Zend\Serializer\Adapter\Json::class);

// Magento Version 2.2.*
if (class_exists(\Magento\Framework\Serialize\Serializer\Serialize::class)) {
$serializer = \Magento\Framework\App\ObjectManager::getInstance()->get(
\Magento\Framework\Serialize\Serializer\Serialize::class
if (class_exists(\Magento\Framework\Serialize\Serializer\Json::class)) {
return \Magento\Framework\App\ObjectManager::getInstance()->get(
\Magento\Framework\Serialize\Serializer\Json::class
);
}

Expand Down

2 comments on commit 742ee30

@aromer
Copy link

@aromer aromer commented on 742ee30 Feb 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks for Magento 2.1 as it still uses the PhpSerialize class. Line 124 should be reverted. I've downgraded my back to 1.3.1 to restore functionality.

@thaiphan
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip!

Please sign in to comment.