magento2: Import failed: Unable to unserialize value, string is corrupted
Preconditions
- Magneto 2.2.0 RC3
Steps to reproduce
- bin/magento setup:upgrade
Expected result
For the data config to be updated
Actual result
- Import failed: Unable to unserialize value, string is corrupted.

Temporary Work Around
UPDATE flag SET flag_data = '{"system":"","scopes":"","themes":""}' WHERE flag_code = 'config_hash';
UPDATE flag SET flag_data = '{}' WHERE flag_code = 'system_config_snapshot';
Flush Cache Run bin/magento setup:upgrade or bin/magento app:config:import.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 18
- Comments: 18 (7 by maintainers)
I spontaneously had this issue when dumping and importing my config, zero issues prior.
@LiamKarlMitchell posted the fix. The issue was that the flag_data table was too small and the JSON was cut off prematurely.
Any chance we can get the default size of the table to be longtext?
Magento 2.3.3.
I have the same issue, but it is caused by something more serious: The flag_data field in the flag table is too short to contain the whole json config.
That field is a TEXT field, so it can contain 65,535 chars. My serialized json is 71,347 so it is truncated at the end and it is not valid json anymore.
@orlangur can you take another look on this issue please?
@DavaGordon thanks for your reply. My issue wasn’t actually in a third party module, but in the
flagtable (more info: https://github.com/magento/magento2/issues/11657).It looks to me like the Worldpay_Payments module has not been updated to use the new Magento 2.2 serialization methods. Most likely there is data that needs to be converted from PHP serialization to JSON, and the module itself may need to be updated to use the new serialization classes.
Dunno if anyone will find this helpful but I found that I had a configuration issue in my
env.phpwhereby I had 2 areas referencing different databases:Had
my_db_1in 1 andmy_db_2in the other. Upon matching these I ran:And the configuration was no longer greyed out / disabled / unchangeable.
@DavaGordon how did you find out it was the MageWox module? I’m running into the same issue but I haven’t found the error yet.