Upgrade Magento EE 2.3.0 to 2.3.4 | Unable to unserialize value. Error: Syntax error

Upgrade Magento EE 2.3.0 to 2.3.4 | Unable to unserialize value. Error: Syntax error

This article covers a special case that may occur if you use the same dataset as us. We were aiming to update the current Magento version to the latest stable one – 2.3. * At the time of writing this article, the latest version was 2.3.4.

The update process was quite fast and trivial, so we will not go into detail about it. The issue we faced was not centered in the update process, but rather what we got as a result of its execution. Furthermore, we have a list of things that may occur after update, which can serve as a reference for you in what you might face after updating.

Unable to apply data patch Magento\Wishlist\Setup\Patch\Data\CleanUpData for module Magento_Wishlist

Original exception message: Unable to unserialize value. Error: Syntax error

Class
/vendor/magento/module-wishlist/Setup/Patch/Data/CleanUpData.php

line 81.
$rowValue = $this->json->unserialize($optionRow['value']);

A more detailed description. Everything found in the wishlist_item_option table cannot be unserialized for an unknown reason, so the update process cannot be completed properly and we cannot proceed to the next stage of testing.

What the function does. It selects data from the wishlist_item_option table, while the values in the “Value” column remain unserialized, and the login element is deleted from the resulting array.

After this, the array is serialized, and the data in the “Value” column is updated. To put it simply, certain secure data like logins is deleted.

We are of the opinion that the SQL query simply lacks the conditions to select entries responsible for the code='info_buyRequest' condition, because only this data is serialized and this condition gives us some assurance that you will be working with an array of data and not a single line. This can be attributed to the impossibility of executing a function for a line that is not serialized, causing the issue at hand.

Possible solutions

  1. The simplest – delete the file from the vendor folder (/vendor/magento/module-wishlist/Setup/Patch/Data/CleanUpData.php) because this class I no longer used.
  2. More complicated – suitable when you have no access to code (for instance, if Magento Cloud only allows reading of files). The only essential condition is that you must have access to the database.
    Perform the following query to make sure that your table does not contain any secure data.

SQL Query
select JSON_EXTRACT(e.value, '$.login') AS login from wishlist_item_option AS e
WHERE e.code='info_buyRequest'
HAVING login IS NOT NULL

Make a backup of the wishlist_item_option table and then clear it out.

Continue the update procedure. The issue should be resolved.
After all of these modifications, restore the data of the wishlist_item_option table from the previously generated backup.

Other Articles

The Power of Social Commerce: Real-Life Case Studies

As an ecommerce business owner, I've always been intrigued by the power of social media and its potential to boost sales. Social commerce, the integration of social media and ecommerce, has emerged as a game-changer in the industry. It allows businesses to reach and engage with their target audience on

Read more

2024 Sustainable eCommerce Growth: Key Trends Shaping Eco-Friendly Online Shopping

‍‍ In recent years, the concept of sustainability has become increasingly important in various industries, and e-commerce is no exception. Sustainable e-commerce refers to the practice of conducting online business operations in an environmentally friendly and socially responsible manner. This article will delve into the emerging trends in sustainable e-commerce, highlighting

Read more
Beyond Code – We Build Experiences: Dive Into a Realm Where Every Line of Code Crafts a Story

We don't just code; we breathe life into your digital aspirations. Our expertise in coding is complemented by our design approach and strategic marketing initiatives, ensuring your brand not only looks good but performs exceptionally.

Begin Your Story