How can I unserialize this string?

2019-08-11 16:24发布

问题:

I have this string in serialize format

a:6:{s:5:"width";i:452;s:6:"height";i:336;s:14:"hwstring_small";s:23:"height='96' width='128'";s:4:"file";s:20:"2012/01/Picture3_410_1325761656.jpg";s:5:"sizes";a:8:{s:9:"thumbnail";a:3:{s:4:"file";s:35:"Picture3_410_1325761656-162x160.jpg";s:5:"width";i:162;s:6:"height";i:160;}s:6:"medium";a:3:{s:4:"file";s:35:"Picture3_410_1325761656-258x191.jpg";s:5:"width";i:258;s:6:"height";i:191;}s:8:"post-top";a:3:{s:4:"file";s:35:"Picture3_410_1325761656-110x110.jpg";s:5:"width";i:110;s:6:"height";i:110;}s:9:"post-tiny";a:3:{s:4:"file";s:35:"Picture3_410_1325761656-108x100.jpg";s:5:"width";i:108;s:6:"height";i:100;}s:9:"post-item";a:3:{s:4:"file";s:35:"Picture3_410_1325761656-452x327.jpg";s:5:"width";i:452;s:6:"height";i:327;}s:11:"post-review";a:3:{s:4:"file";s:35:"Picture3_410_1325761656-162x166.jpg";s:5:"width";i:162;s:6:"height";i:166;}s:9:"post-poll";a:3:{s:4:"file";s:35:"Picture3_410_1325761656-285x237.jpg";s:5:"width";i:285;s:6:"height";i:237;}s:14:"post-top-story";a:3:{s:4:"file";s:35:"Picture3_410_1325761656-300x130.jpg";s:5:"width";i:300;s:6:"height";i:130;}}s:10:"image_meta";a:10:{s:8:"aperture";i:0;s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";i:0;s:9:"copyright";s:0:"";s:12:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";s:0:"";}}

which is used in wordpress but when i unserialize it , its giving an error as-

WARNING: Error at offset 132 of 1316 bytes 

Please suggest some solution.

Thanks

//Array

Array([width]=>800[height]=>600[hwstring_small]=>height='96'width='128'[file]=>2012/01/Waterlilies_294_1325828605.jpg[sizes]=>Array([thumbnail]=>Array([file]=>Waterlilies_294_1325828605-162x160.jpg[width]=>162[height]=>160)[medium]=>Aray([file]=>Waterlilies_294_1325828605-258x193.jpg[width]=>258[height]=>193)[large]=>Array([file]=>Waterlilies_294_132528605-506x380.jpg[width]=>506[height]=>380)[post-blog]=>Array([file]=>Waterlilies_294_1325828605-545x408.jpg[width]=>55[height]=>408)[post-special]=>Array([file]=>Waterlilies_294_1325828605-530x380.jpg[width]=>530[height]=>380)[post-top=>Array([file]=>Waterlilies_294_1325828605-110x110.jpg[width]=>110[height]=>110)[post-tiny]=>Array([file]=>Waterlilies294_1325828605-108x100.jpg[width]=>108[height]=>100)[post-item]=>Array([file]=>Waterlilies_294_1325828605-455x327.jpg[idth]=>455[height]=>327)[post-review]=>Array([file]=>Waterlilies_294_1325828605-162x166.jpg[width]=>162[height]=>166)
[post-poll]=>Array([file]=>Waterlilies_294_1325828605-285x237.jpg[width]=>285[height]=>237)[post-top-story]=>Array([fil]=>Waterlilies_294_1325828605-300x130.jpg[width]=>300[height]=>130))[image_meta]=>Array([aperture]=>0[credit]=>[camera]=>[caption]=>[created_timestamp]=>0[copyright]=>[focal_length]=>0[iso]=>0[shutter_speed]=>0[title]=>)[photoURL]=>C:/xampphtdocs/wp-content/uploads/2012/01/Waterlilies_294_1325828605.jpg)

回答1:

First, find out where it's broken. Then, repair it.

To get you started, the value at 108 should be 35, not 20.



回答2:

This might help: http://davidwalsh.name/php-serialize-unserialize-issues