[wp-hackers] question regarding serialization and unserialization

Scott Plumlee wp-hackers at plumlee.org
Thu Sep 28 11:23:56 GMT 2006


Jeff Minard wrote:
> Scott Plumlee wrote:
>> The only thing that is strange is that only ONE particular value (for 
>> a plugin, it's in the wp_options table) seem to NOT be unserialized 
>> correctly.  Most of the values seem fine, but this one in particular 
>> is no longer recognized as an array.
> 
> Yeah, I think you have to change not only the string in question, but 
> also the definition of how long the string is.
> 
> something like
>  "s:5,s:abcdef"  ->  "s:6,s:abcdef"
> 

Sorry. I should clarify that I did that.  This would be one of my first 
attempts at using perl like this, so this is pretty ugly:

perl -p -i -e 
's!s:(\d+)(?{$val=5+$1}):"\\http:\/\/abcd!s:$^R:"\\http:\/\/abcd!g'

I'm adding :8000 to the name of the site, so I added 5 characters to the 
  string length.


More information about the wp-hackers mailing list