93
votes
Magento 2.2: Unable to unserialize value?
I was able to resolve this issue by Flushing my Redis Cache from the CLI
redis-cli flushall
I hope this helps future users.
36
votes
Magento 2.2: Unable to unserialize value?
The problem is in /vendor/magento/framework/Serialize/Serializer/Json.php there is a function unserialize($string) which gives you a syntax error if string is serialized (not json but php ...
30
votes
Magento 2.2: Unable to unserialize value?
In my case, I patched as follows to unserialize a serialized string:
File: /vendor/magento/framework/Serialize/Serializer/Json.php
Find:
public function unserialize($string)
{
$result = ...
26
votes
Magento 2.2: Unable to unserialize value?
Do not edit core files for solution. Override following way
Just put following line in di.xml inside etc directory
<preference for="Magento\Framework\Serialize\Serializer\Json" type="Namespace\...
7
votes
Magento 2.2: Unable to unserialize value?
After flushing Redis the issue has sorted.
Thank you Craig for the solution.
I'm using port 6379 for cache, so I run command :
redis-cli -p 6379 flushall
6
votes
Accepted
Error on image upload with REST api
In base64_encoded_data pass only Base64 Encoded Data of image.
Below is the correct body request.
{
"entry": {
"media_type": "image",
"label": "Image",
"disabled": false,
"types": [
"...
4
votes
Magento 2.2: Unable to unserialize value?
It's mostly related with Redis cache, so try to flush out this with simple command in your SSH
redis-cli flushall
4
votes
Accepted
Magento 2.2: Unable to unserialize value?
It turned out to be a permissions issue, where magento was setting permissions for generated files that were restricted on this server.
Solved by creating magento_umask file in the root directory ...
4
votes
Accepted
I am getting 'Unable to unserialize value' while editing a customer in magento 2.2
It was a 3rd party extension issue
I found this solution helpful.
https://magento.stackexchange.com/a/257393/70848
3
votes
Accepted
How to fix "Unable to unserialize value. Error: Syntax error" Magento 2.3.2
Magento change serialization from php to json in 2.1 version.
Looks like you have some data in database is not converted to proper format for some reason.
So, you need to convert co it manually to ...
3
votes
Detecting possible issues with serialized data after Magento 2.2 upgrade
Solution: -
Step 1.
Magento has provided a guideline for resolving this issue.
https://devdocs.magento.com/guides/v2.2/ext-best-practices/tutorials/serialized-to-json-data-upgrade.html
And another ...
3
votes
Magento 2.2 error: Unable to unserialize value
The problem is in /vendor/magento/framework/Serialize/Serializer/Json.php there is a function unserialize($string) which gives you a syntax error if the string is already serialized.
There is a ...
3
votes
Accepted
How do I use unserialize method instead of json_decode
You have to inject Magento\Framework\Serialize\SerializerInterface in your constructor
namespace Vendor\Module;
use Magento\Framework\Serialize\SerializerInterface;
class MyClass
{
/**
* @...
2
votes
Magento 2 how to unserialize backend config
This worked for me.
use Magento\Framework\Serialize\SerializerInterface;
public function __construct
(
SerializerInterface $serializer
)
{
$this->serializer = $serializer;
}
public ...
2
votes
Accepted
Magento 2.2 error: Unable to unserialize value
So, solution is write a UpdateData script in the own module which change the default serialized values to the JSON (like Magento does it in the CatalogRules module):
app/code/MageWorx/ShippingRules/...
2
votes
Magento 2.2 - Unable to unserialize value, when editing categories
The problem is in /vendor/magento/framework/Serialize/Serializer/Json.php there is a function unserialize($string) which gives You a syntax error if string is serialized.
There is a workaround - You ...
2
votes
Magento 2.2: Unable to unserialize value?
For what it is worth, the above approach did not work for me and I found that an empty string was being passed to the unserialize function. Doing a check and returning an empty array solved my issue. ...
2
votes
Magento 2.2: Unable to unserialize value?
Sameers' answer above worked for me although i had to use different code in the block.
public function serialize($data)
{
$result = json_encode($data);
if (false === $result) {
throw ...
2
votes
Magento 2.2: Unable to unserialize value?
I personally found this issue reared it's head running the command:
php bin/magento setup:upgrade
After a migration. I found out that I was missing the "crypt" hash key in src/app/etc/env.php:
<?...
2
votes
Failure reason: 'Unable to unserialize value, string is corrupted.' after upgrade magento 2.1.5 to magento 2.2.6
I had this problem too. The issue is exactly what the error message is saying... the data is corrupt. For me the corruption looked as if the values had been clipped at the end.
For example, some of ...
2
votes
Accepted
Magento 2: Unable to unserialize value. Error: Control character error, possibly incorrectly encoded
I solve this issue by flushing my Redis Cache from by running following commands
redis-cli
flushall
I hope this works.
EDIT
try this
https://www.scommerce-mage.com/blog/solved-unable-to-...
2
votes
how to properly serialize / unserialize magento 2 models to json format
<?php
namespace Demo\Demo\Demo;
use Magento\Framework\Serialize\SerializerInterface;
class DemoClass
{
/**
* @var SerializerInterface
*/
protected $serializer;
public ...
2
votes
how to properly serialize / unserialize magento 2 models to json format
I highly suggest using \Magento\Framework\Serialize\Serializer\Json
1
vote
Unable to run magento 2 commands after upgrade
The issue was fixed with below steps.
Edit your index.php put this at the start of the file:
die('maintenance');
to stop requests hitting the box and breaking things. (this can happen even if you ...
1
vote
Accepted
Magento 2.3.1 unserialize error
Please go here and change the code as per the below instruction.
public function encrypt($params)
{
return base64_encode($this->encryptor->encrypt(json_encode($params)));
}
/**
...
1
vote
Failure reason: 'Unable to unserialize value, string is corrupted.' after upgrade magento 2.1.5 to magento 2.2.6
I also had the same issue and it seems to be flag table flag_data column (TEXT type) has to be changed (LONGTEXT type) since config file has more data which could not possible to store in TEXT length. ...
1
vote
Magento 2.2: Unable to unserialize value
This is the problem with your cache.
Just cleared your magento cache. If you are using any third party cache like Redis, just flush it and try. It will fix this problem.
1
vote
Magento 2.2 error: Unable to unserialize value
In my case flushing redis cache redis-cli flushall the solved issue.
1
vote
Magento 2.2: Unable to unserialize value?
ROOT directory
1. public_html/vendor/magento/framework/Serialize/Serializer/Json.php
Download JSON.php https://gist.github.com/manojind/9f18bbecaeb3e2bbfb056a634ade62a2
2. Just replace below ...
1
vote
Magento 2.2: Unable to unserialize value?
I was getting the error in a CMS page in front end.
It was the Magento widget code in the CMS Page Content that was causing problem(which I copied from another source). I deleted the widget code and ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
unserialize × 38magento2 × 17
json × 9
magento2.2 × 7
magento-1.9 × 3
error × 3
magento-2.1 × 2
magento2.3 × 2
php × 2
customer × 2
custom-options × 2
magento2.2.2 × 2
magento-upgrade × 2
data-migration × 2
setup-upgrade × 2
php-7.2 × 2
serialize × 2
admin × 1
event-observer × 1
product-attribute × 1
uicomponent × 1
addtocart × 1
magento2.4 × 1
controllers × 1
rest × 1