Home >Unserialize Errors in Magento 2 versions

Unserialize Errors in Magento 2 versions

Have you ever had the errors “Unable to Serialize value” (Magento 2 unable to unserialize value) when trying to open website Frontend and Backend, after you successfully upgraded Magento 2.2.x from Magento 2.1.x?

We have received many questions relating to the Magento 2 unable to unserialize value errors during the processing development. Today we would like to introduce how to fix the errors when upgrading Magento 2.2.x.

Errors

You could easily find the following errors of Magento 2 unable to unserialize value at Demo.

The errors could appear in the following config.

The root cause is due to Magento 2.2.x changing how to save serialized config from PHP serialize to json, which makes you must handle to 2 different ways when you want to get config out on Magento 2.1.x and 2.2.x.

Solution

We could create the serialized config at Backend model in order to save database on Magento versions independently. We choose to save database by php serialize.

Create the class of Magento 2.1.x by handling to serialize an array and unserialize on the same method. To resolve the errors, please follow our steps.

Step 1: Create class.

Step 2: Declare to system.xml – Backend model.

Step 3: Call out function php unserialize().

Hope the article help you handle the problems when upgrading Magento versions.

< Previous Post
Next Post >
+ posts