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

Case Study: How we shifted 78%+ of B2B Orders to Self-Service in 5 Months Using a Custom B2B Portal

About the Client The client is a globally operating industrial manufacturer specializing in high-precision pumping systems and fluid-handling equipment. The company serves more than 24,000 active B2B customers across manufacturing, chemical processing, food production, and engineering industries. With decades of market presence, the client is recognized for engineering excellence,

Read more

How We Scaled B2B eCommerce Without Rebuilding the Website

From Manual PIM and Email Quotes to Scalable B2B eCommerce in 2 months, without fuss and within budget * e-Commerce integration without rebuilding the existing TYPO3 website * Automated product and pricing updates from PIM (no more manual maintenance) * Real-time or near real-time stock synchronization * Tiered / quantity-based pricing visible to customers as

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