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


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'

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

A Guide to Optimizing Your Magento Store for Peak Performance

Why Does Magento Speed Matter? As an online retailer, the speed of your Magento store is crucial to your success. In today's fast-paced digital world, users have high expectations when it comes to website performance. If your Magento store is slow, it can have a significant impact on user experience

Read more

BigCommerce B2B Edition: A Guide to Scaling Your Online Presence

In today's digital age, moving your business online is no longer an option, but a necessity. However, making that transition can be challenging, especially for B2B businesses. Fortunately, there are platforms like BigCommerce B2B Edition that can help you overcome these challenges and unlock the true potential of your online

Read more

7 Top Magento Payment Gateways in 2024

What is a payment gateway? A payment gateway is an essential component of any e-commerce platform, including Magento. It acts as an intermediary between the customer and the merchant, securely transmitting payment data during online transactions. When a customer makes a purchase on a Magento website, the payment gateway encrypts

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