反序列化-偏移量9179的11507字节错误

时间:2018-08-19 21:13:19

标签: php serialization

我正在使用php 7.1,并且想要unserialize以下值:

a:1:{s:13:"us-B07F11V8SM";a:32:{s:5:"price";s:7:"5250.00";s:8:"priceOld";s:0:"";s:15:"percentageSaved";i:0;s:8:"currency";s:1:"$";s:12:"currencyCode";s:3:"USD";s:12:"manufacturer";s:11:"Innosilicon";s:8:"category";s:0:"";s:12:"categoryPath";a:0:{}s:8:"merchant";s:10:"Amazon.com";s:4:"logo";s:0:"";s:6:"domain";s:10:"amazon.com";s:6:"rating";s:0:"";s:12:"reviewsCount";s:0:"";s:12:"availability";s:0:"";s:8:"orig_url";s:0:"";s:3:"ean";s:13:"0603432616995";s:3:"upc";s:0:"";s:3:"sku";s:0:"";s:4:"isbn";s:0:"";s:8:"woo_sync";s:0:"";s:8:"woo_attr";s:0:"";s:8:"features";a:16:{i:0;a:2:{s:4:"name";s:7:"Binding";s:5:"value";s:11:"Electronics";}i:1;a:2:{s:4:"name";s:5:"Brand";s:5:"value";s:11:"Innosilicon";}i:2;a:2:{s:4:"name";s:3:"EAN";s:5:"value";s:13:"0603432616995";}i:3;a:2:{s:4:"name";s:8:"EAN List";s:5:"value";s:31:"EAN List Element: 0603432616995";}i:4;a:2:{s:4:"name";s:15:"Item Dimensions";s:5:"value";s:12:"Weight: 1764";}i:5;a:2:{s:4:"name";s:5:"Label";s:5:"value";s:11:"Innosilicon";}i:6;a:2:{s:4:"name";s:12:"Manufacturer";s:5:"value";s:11:"Innosilicon";}i:7;a:2:{s:4:"name";s:18:"Package Dimensions";s:5:"value";s:12:"Weight: 1764";}i:8;a:2:{s:4:"name";s:16:"Package Quantity";s:5:"value";s:1:"1";}i:9;a:2:{s:4:"name";s:13:"Product Group";s:5:"value";s:12:"PC Accessory";}i:10;a:2:{s:4:"name";s:17:"Product Type Name";s:5:"value";s:25:"COMPUTER_DRIVE_OR_STORAGE";}i:11;a:2:{s:4:"name";s:9:"Publisher";s:5:"value";s:11:"Innosilicon";}i:12;a:2:{s:4:"name";s:6:"Studio";s:5:"value";s:11:"Innosilicon";}i:13;a:2:{s:4:"name";s:5:"Title";s:5:"value";s:198:"50Ksol/s 620W, Innosilicon announces World Best Equihash Miner A9 ZMaster with PSU with low consumption Produce $80 to $100 a Day(In Stock) ready for shipment higher than D9 DecredMaster Asic Miner.";}i:14;a:2:{s:4:"name";s:3:"UPC";s:5:"value";s:12:"603432616995";}i:15;a:2:{s:4:"name";s:8:"UPC List";s:5:"value";s:30:"UPC List Element: 603432616995";}}s:9:"unique_id";s:13:"us-B07F11V8SM";s:5:"title";s:198:"50Ksol/s 620W, Innosilicon announces World Best Equihash Miner A9 ZMaster with PSU with low consumption Produce $80 to $100 a Day(In Stock) ready for shipment higher than D9 DecredMaster Asic Miner.";s:11:"description";s:0:"";s:3:"img";s:124:"http://coindation.com/wp-content/uploads/2018/07/50ksols-620w-innosilicon-announces-world-best-equihash-miner-a9-zmaster.jpg";s:3:"url";s:209:"https://www.amazon.com/Innosilicon-announces-Equihash-consumption-DecredMaster/dp/B07F11V8SM?SubscriptionId=AKIAIZ3S74HU3GOABUYQ&tag=coindation-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07F11V8SM";s:11:"last_update";s:10:"1534678571";s:5:"added";s:1:"1";s:7:"keyword";s:11:"Innosilicon";s:8:"img_file";s:83:"2018/07/50ksols-620w-innosilicon-announces-world-best-equihash-miner-a9-zmaster.jpg";s:5:"extra";a:29:{s:6:"locale";s:2:"us";s:13:"associate_tag";s:13:"coindation-20";s:9:"itemLinks";a:7:{i:0;a:2:{s:11:"Description";s:17:"Technical Details";s:3:"URL";s:219:"https://www.amazon.com/Innosilicon-announces-Equihash-consumption-DecredMaster/dp/tech-data/B07F11V8SM?SubscriptionId=AKIAIZ3S74HU3GOABUYQ&tag=coindation-20&linkCode=xm2&camp=2025&creative=386001&creativeASIN=B07F11V8SM";}i:1;a:2:{s:11:"Description";s:20:"Add To Baby Registry";s:3:"URL";s:188:"https://www.amazon.com/gp/registry/baby/add-item.html?asin.0=B07F11V8SM&SubscriptionId=AKIAIZ3S74HU3GOABUYQ&tag=coindation-20&linkCode=xm2&camp=2025&creative=386001&creativeASIN=B07F11V8SM";}i:2;a:2:{s:11:"Description";s:23:"Add To Wedding Registry";s:3:"URL";s:191:"https://www.amazon.com/gp/registry/wedding/add-item.html?asin.0=B07F11V8SM&SubscriptionId=AKIAIZ3S74HU3GOABUYQ&tag=coindation-20&linkCode=xm2&camp=2025&creative=386001&creativeASIN=B07F11V8SM";}i:3;a:2:{s:11:"Description";s:15:"Add To Wishlist";s:3:"URL";s:192:"https://www.amazon.com/gp/registry/wishlist/add-item.html?asin.0=B07F11V8SM&SubscriptionId=AKIAIZ3S74HU3GOABUYQ&tag=coindation-20&linkCode=xm2&camp=2025&creative=386001&creativeASIN=B07F11V8SM";}i:4;a:2:{s:11:"Description";s:13:"Tell A Friend";s:3:"URL";s:161:"https://www.amazon.com/gp/pdp/taf/B07F11V8SM?SubscriptionId=AKIAIZ3S74HU3GOABUYQ&tag=coindation-20&linkCode=xm2&camp=2025&creative=386001&creativeASIN=B07F11V8SM";}i:5;a:2:{s:11:"Description";s:20:"All Customer Reviews";s:3:"URL";s:165:"https://www.amazon.com/review/product/B07F11V8SM?SubscriptionId=AKIAIZ3S74HU3GOABUYQ&tag=coindation-20&linkCode=xm2&camp=2025&creative=386001&creativeASIN=B07F11V8SM";}i:6;a:2:{s:11:"Description";s:10:"All Offers";s:3:"URL";s:167:"https://www.amazon.com/gp/offer-listing/B07F11V8SM?SubscriptionId=AKIAIZ3S74HU3GOABUYQ&tag=coindation-20&linkCode=xm2&camp=2025&creative=386001&creativeASIN=B07F11V8SM";}}s:8:"imageSet";a:5:{i:0;a:7:{s:10:"attributes";a:1:{s:8:"Category";s:7:"variant";}s:11:"SwatchImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/51xuTtKHb2L._SL30_.jpg";s:10:"SmallImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/51xuTtKHb2L._SL75_.jpg";s:14:"ThumbnailImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/51xuTtKHb2L._SL75_.jpg";s:9:"TinyImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/51xuTtKHb2L._SL110_.jpg";s:11:"MediumImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/51xuTtKHb2L._SL160_.jpg";s:10:"LargeImage";s:64:"https://images-na.ssl-images-amazon.com/images/I/51xuTtKHb2L.jpg";}i:1;a:7:{s:10:"attributes";a:1:{s:8:"Category";s:7:"variant";}s:11:"SwatchImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL30_.jpg";s:10:"SmallImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL75_.jpg";s:14:"ThumbnailImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL75_.jpg";s:9:"TinyImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL110_.jpg";s:11:"MediumImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL160_.jpg";s:10:"LargeImage";s:64:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L.jpg";}i:2;a:7:{s:10:"attributes";a:1:{s:8:"Category";s:7:"variant";}s:11:"SwatchImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/51-Ij429VEL._SL30_.jpg";s:10:"SmallImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/51-Ij429VEL._SL75_.jpg";s:14:"ThumbnailImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/51-Ij429VEL._SL75_.jpg";s:9:"TinyImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/51-Ij429VEL._SL110_.jpg";s:11:"MediumImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/51-Ij429VEL._SL160_.jpg";s:10:"LargeImage";s:64:"https://images-na.ssl-images-amazon.com/images/I/51-Ij429VEL.jpg";}i:3;a:7:{s:10:"attributes";a:1:{s:8:"Category";s:7:"variant";}s:11:"SwatchImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/51PxlCNXMuL._SL30_.jpg";s:10:"SmallImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/51PxlCNXMuL._SL75_.jpg";s:14:"ThumbnailImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/51PxlCNXMuL._SL75_.jpg";s:9:"TinyImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/51PxlCNXMuL._SL110_.jpg";s:11:"MediumImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/51PxlCNXMuL._SL160_.jpg";s:10:"LargeImage";s:64:"https://images-na.ssl-images-amazon.com/images/I/51PxlCNXMuL.jpg";}i:4;a:7:{s:10:"attributes";a:1:{s:8:"Category";s:7:"primary";}s:11:"SwatchImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL30_.jpg";s:10:"SmallImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL75_.jpg";s:14:"ThumbnailImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL75_.jpg";s:9:"TinyImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL110_.jpg";s:11:"MediumImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL160_.jpg";s:10:"LargeImage";s:64:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L.jpg";}}s:11:"AmountSaved";s:0:"";s:15:"PercentageSaved";s:0:"";s:31:"IsEligibleForSuperSaverShipping";s:0:"";s:15:"customerReviews";a:0:{}s:16:"editorialReviews";a:0:{}s:10:"smallImage";s:71:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL75_.jpg";s:11:"mediumImage";s:72:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L._SL160_.jpg";s:10:"largeImage";s:64:"https://images-na.ssl-images-amazon.com/images/I/517O2NFtK0L.jpg";s:12:"addToCartUrl";s:100:"http://www.amazon.com/gp/aws/cart/add.html?ASIN.1=B07F11V8SM&Quantity.1=1&AssociateTag=coindation-20";s:4:"ASIN";s:10:"B07F11V8SM";s:14:"itemAttributes";a:68:{s:5:"Actor";s:0:"";s:6:"Artist";s:0:"";s:11:"AspectRatio";s:0:"";s:14:"AudienceRating";s:0:"";s:11:"AudioFormat";s:0:"";s:7:"Binding";s:11:"Electronics";s:5:"Brand";s:11:"Innosilicon";s:13:"CEROAgeRating";s:0:"";s:12:"ClothingSize";s:0:"";s:5:"Color";s:0:"";s:7:"Creator";s:0:"";s:10:"Department";s:0:"";s:8:"Director";s:0:"";s:3:"EAN";s:13:"0603432616995";s:7:"EANList";s:0:"";s:7:"Edition";s:0:"";s:5:"EISBN";s:0:"";s:15:"EpisodeSequence";s:0:"";s:13:"ESRBAgeRating";s:0:"";s:7:"Feature";a:4:{i:0;s:137:"?A9 Hashrate is 50Ksol/s, can make about $80 to $100 a day according to 25th, June calculation. We can not guarantee the later profits.";i:1;s:222:"?Please check Innosilicon A9 on website about it's Profits before you buy and make serious consideration, Because we do not accept any return or refund of this miner. Ship By DHL, generally need 3-7 days, you can get it.";i:2;s:156:"?Power Consumption: 620W (+/-8%, normal mode, at the wall, with 12.4j/ksol efficiency , Include Innosilicon PSU power supply ATX�Power�(12V�9�*�6pin)";i:3;s:162:"?Almost the most profitable Virtual Currency Miner machine right now. Antminer S9 produce about $6 a day. A9 can do $80 to $100 a day according to 25th profits.";}s:6:"Format";s:0:"";s:5:"Genre";s:0:"";s:16:"HardwarePlatform";s:0:"";s:21:"HazardousMaterialType";s:0:"";s:14:"IsAdultProduct";s:0:"";s:13:"IsAutographed";s:0:"";s:4:"ISBN";s:0:"";s:20:"IsEligibleForTradeIn";s:0:"";s:13:"IsMemorabilia";s:0:"";s:13:"IssuesPerYear";s:0:"";s:14:"ItemDimensions";s:0:"";s:14:"ItemPartNumber";s:0:"";s:5:"Label";s:11:"Innosilicon";s:9:"Languages";s:0:"";s:15:"LegalDisclaimer";s:0:"";s:22:"ManufacturerMaximumAge";s:0:"";s:22:"ManufacturerMinimumAge";s:0:"";s:36:"ManufacturerPartsWarrantyDescription";s:0:"";s:9:"MediaType";s:0:"";s:5:"Model";s:0:"";s:3:"MPN";s:0:"";s:13:"NumberOfDiscs";s:0:"";s:14:"NumberOfIssues";s:0:"";s:13:"NumberOfItems";s:0:"";s:13:"NumberOfPages";s:0:"";s:14:"NumberOfTracks";s:0:"";s:15:"OperatingSystem";s:0:"";s:15:"PackageQuantity";s:1:"1";s:10:"PartNumber";s:0:"";s:8:"Platform";s:0:"";s:12:"ProductGroup";s:12:"PC Accessory";s:22:"ProductTypeSubcategory";s:0:"";s:15:"PublicationDate";s:0:"";s:9:"Publisher";s:11:"Innosilicon";s:10:"RegionCode";s:0:"";s:11:"ReleaseDate";s:0:"";s:11:"RunningTime";s:0:"";s:18:"SeikodoProductCode";s:0:"";s:4:"Size";s:0:"";s:3:"SKU";s:0:"";s:6:"Studio";s:11:"Innosilicon";s:18:"SubscriptionLength";s:0:"";s:12:"TradeInValue";s:0:"";s:3:"UPC";s:12:"603432616995";s:7:"UPCList";s:0:"";s:8:"Warranty";s:0:"";s:12:"WEEETaxValue";s:0:"";s:17:"PackageDimensions";s:0:"";}s:14:"toLowToDisplay";s:0:"";s:12:"availability";s:0:"";s:14:"lowestNewPrice";s:7:"5250.00";s:15:"lowestUsedPrice";s:0:"";s:22:"lowestCollectiblePrice";s:0:"";s:22:"lowestRefurbishedPrice";s:0:"";s:8:"totalNew";s:2:"10";s:9:"totalUsed";s:1:"0";s:16:"totalCollectible";s:1:"0";s:16:"totalRefurbished";s:1:"0";s:4:"date";s:0:"";s:6:"author";s:0:"";s:6:"source";s:0:"";s:6:"domain";s:0:"";}}}

但是,出现以下错误:Error at offset 9179 of 11507 bytes

unserialize函数返回false

任何建议我的琴弦有什么问题吗?我已经预先序列化了该值,所以我不确定为什么将其反序列化时会出错。

感谢您的答复!

1 个答案:

答案 0 :(得分:1)

这可能是编码问题。问题始于字符串

s:137:"?A9 Hashrate is 50Ksol/s ...

当我复制字符串时,它只有135个字节长,并且使用s:135:可以正确地反序列化:“ ...

您可以手动更正那些字符串(在示例中只有4个),或者找出用于序列化的字符集以及用于反序列化的字符集。我觉得 ?标记最初是3个字节的字符。

此问题过去曾出现过。对于半自动化的解决方案,您可以尝试this answer中的正则表达式。但是当您在序列化的字符串中使用双引号和分号时,该正则表达式将阻塞。