jargener Posted October 15, 2017 Share Posted October 15, 2017 Im trying to convert some legacy data, however php errors when trying to unserialize this a:19:{s:5:"label";s:32:"Would you like a Luxury Gift Box";s:9:"label_pos";s:5:"above";s:9:"list_type";s:8:"dropdown";s:10:"multi_size";s:1:"5";s:15:"list_show_value";s:1:"0";s:4:"list";a:1:{s:7:"options";a:2:{i:0;a:4:{s:5:"label";s:11:"No Gift Box";s:5:"value";s:0:"";s:4:"calc";s:4:"0.00";s:8:"selected";s:1:"1";}i:1;a:4:{s:5:"label";s:22:"Luxury Gift Box (+£5)";s:5:"value";s:0:"";s:4:"calc";s:4:"5.00";s:8:"selected";s:1:"0";}}}s:21:"user_info_field_group";s:0:"";s:3:"req";s:1:"1";s:17:"calc_auto_include";s:1:"1";s:10:"user_state";s:1:"0";s:8:"num_sort";s:1:"0";s:11:"admin_label";s:0:"";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:9:"show_desc";s:1:"0";s:8:"desc_pos";s:4:"none";s:9:"desc_text";s:0:"";s:11:"conditional";s:0:"";} Showing this error: Notice: unserialize(): Error at offset 363 of 759 bytes in Which i believe is down to the plus symbol in the data, any way around this error? Link to comment Share on other sites More sharing options...
requinix Posted October 15, 2017 Share Posted October 15, 2017 Make sure the serialized string is in the same encoding as it was when it was first created. Probably UTF-8. And that's not a plus. It's a pound sign. Like the currency. Link to comment Share on other sites More sharing options...
jargener Posted October 15, 2017 Author Share Posted October 15, 2017 Make sure the serialized string is in the same encoding as it was when it was first created. Probably UTF-8. And that's not a plus. It's a pound sign. Like the currency. I have no idea what the original encoding was,and i'm talking about the plus sign before the pound sign? Link to comment Share on other sites More sharing options...
requinix Posted October 15, 2017 Share Posted October 15, 2017 Unless I miscounted, the error is talking about either the closing quote of that string or the semicolon after it, which means that PHP discovered a problem while processing that part of the array. If you don't know the original encoding then look at the string's bytes and make an educated guess. I've already given you one. Link to comment Share on other sites More sharing options...
ginerjm Posted October 16, 2017 Share Posted October 16, 2017 I agree with Requinex - it appears to ME to be the " at the end of: s:22:"Luxury Gift Box (+£5)"; this value. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.