Error 500 unserialize(): Error at offset 0 of 63 b

Hi,
I am running a Magento 2.2.5 installation and I seem to have a problem on step 8 as in the subject.
How can I solve this?
 
Thanks
 
James

12 answers

Profile photo of Mall Staff 184060.00 $tone July 23, 2018
Public

Hi there,
That seem your M1 database has some bad data in data sections in the step #8. Let’s provide me information about your instance:
+ Admin credentials and URL to back-end
+ SSH credentials and path to Magento folder
I will help to check further and reply you more later.
Regards,
Mall.

#1
Profile photo of Mansi Trivedi 80.00 $tone July 24, 2018
Public

unserialize() [function.unserialize]: Error at offset was dues to invalid serialization data due to invalid length
Quick Fix
What you can do is is recalculating the length of the elements in serialized array
You current serialized data

$data = 'a:10:{s:16:"submit_editorial";b:0;s:15:"submit_orig_url";s:13:"www.bbc.co.uk";s:12:"submit_title";s:14:"No title found";s:14:"submit_content";s:12:"dnfsdkfjdfdf";s:15:"submit_category";i:2;s:11:"submit_tags";s:3:"bbc";s:9:"submit_id";b:0;s:16:"submit_subscribe";i:0;s:15:"submit_comments";s:4:"open";s:5:"image";s:19:"C:fakepath100.jpg";}';

Example without recalculation

var_dump(unserialize($data));

Output

Notice: unserialize() [function.unserialize]: Error at offset 337 of 338 bytes

Recalculating

$data = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $data);
var_dump(unserialize($data));

Output

array
  'submit_editorial' => boolean false
  'submit_orig_url' => string 'www.bbc.co.uk' (length=13)
  'submit_title' => string 'No title found' (length=14)
  'submit_content' => string 'dnfsdkfjdfdf' (length=12)
  'submit_category' => int 2
  'submit_tags' => string 'bbc' (length=3)
  'submit_id' => boolean false
  'submit_subscribe' => int 0
  'submit_comments' => string 'open' (length=4)
  'image' => string 'C:fakepath100.jpg' (length=17)

Magento Development | Magento Development Company | Hire Magento Developer
#4
Profile photo of longstone 650.00 $tone July 25, 2018
Public

Thanks Mall.
I have tried several times to save my settings but it always comes up with the following warning:
Reminder! You have to complete all settings in the step #7 (Sales) first
I have even migrated the sales and still it comes up with this warning.

#7
Profile photo of Mall Staff 184060.00 $tone July 25, 2018
Public

Hi there,

I have tried several times to save my settings but it always comes up with the following warning:
Reminder! You have to complete all settings in the step #7 (Sales) first

That is strangle. I have checked further in your instance and I saw the code file at path ‘pub/ub-tool/protected/controllers/Step7Controller.php’ on the step #7 of our tool. It is a file from an old version of our migration tool. It is not a code file of version 3.1.5.
I didn’t know how do you install the latest version ver.3.1.5 of our migration tool. And that is root of all issues you mentioned in this post.
And then, I have updated the correct php files for version 3.1.5 for your instance. And now all issue was solved. I have tested settings in the step #8: https://prnt.sc/kapd52
And now, you could continue.
Regards,
Mall.

#8
Profile photo of longstone 650.00 $tone July 25, 2018
Public

Hi Mall,
Thanks. I have run Step 7 but it fails with:
 
Status: fail
Message: Mage2SalesQuoteAddress: Shipping Amount is too long (maximum is 12 characters).
-- Base Shipping Amount is too long (maximum is 12 characters).
-- Shipping Incl Tax is too long (maximum is 12 characters).
-- Base Shipping Incl Tax is too long (maximum is 12 characters).
Thanks

#9
Profile photo of Mall Staff 184060.00 $tone July 25, 2018
Public

Hi there,

Message: Mage2SalesQuoteAddress: Shipping Amount is too long (maximum is 12 characters).
— Base Shipping Amount is too long (maximum is 12 characters).
— Shipping Incl Tax is too long (maximum is 12 characters).
— Base Shipping Incl Tax is too long (maximum is 12 characters).

That issues because your M1 database has some records which has bad data in the value of some fields in table sales_flat_quote_address: shippping_amount, base_shippping_amount, shipping_incl_tax, base_shipping_incl_tax
To handle for that cases, you could do with steps below:
+ Open the php file at path: pub/ub-tool/protected/controllers/Step7Controller.php
and find to the code line: 

} elseif (in_array($key, array( 'discount_amount', 'base_discount_amount','weight', 'subtotal', 'base_subtotal','grand_total', 'base_grand_total','subtotal_incl_tax')) AND strlen($val) > 12) {

and replace it by code lines:

} elseif (in_array($key, array( 'discount_amount',
'base_discount_amount','weight', 'subtotal',
'base_subtotal','grand_total',
'base_grand_total','subtotal_incl_tax',
'shipping_amount','base_shipping_amount',
'shipping_incl_tax','base_shipping_incl_tax'
)) AND strlen($val) > 12) {

+ Once done, you could continue with data migration in the step #7.
Regards,
Mall.
 

#10
Profile photo of longstone 650.00 $tone July 25, 2018
Public

Still get this error:
Status: fail
Message: Mage2SalesQuoteAddress: Shipping Amount is too long (maximum is 12 characters).
-- Base Shipping Amount is too long (maximum is 12 characters).

#11
Profile photo of Mall Staff 184060.00 $tone July 25, 2018
Public

Hi there,

Still get this error:
Status: fail
Message: Mage2SalesQuoteAddress: Shipping Amount is too long (maximum is 12 characters).
— Base Shipping Amount is too long (maximum is 12 characters).

Sorry you about my wrong. I have suggested wrong attribute name in code lines to replace. I have re-update my reply #10
And I have re-update the php file in your instance too. Now you could continue.
Regards,
Mall.

#12

Please login or Register to Submit Answer

Written By

Comments