NYCPHP Meetup

NYPHP.org

[nycphp-talk] Offset error during unserializing data

Dan Cech dcech at phpwerx.net
Thu Nov 3 15:52:22 EST 2005


John,

It looks like you are introducing slashes into the string somewhere.

If you change the string to:

a:3:{i:0;s:3:"foo";i:1;s:3:"bar";i:2;s:11:"foo bar you";}

it will work fine.

You can find more info about the various pitfalls of slash-encoding here:

http://www.nyphp.org/phundamentals/storingretrieving.php

Dan

John Daly wrote:
> Dan,
> 
> This isn't the original string, but it's the error I've been experiencing. 
> Just a three element array of strings.
> 
> Thanks,
> 
> John
> 
> 
>  sst Row: a:3:{i:0;s:3:\"foo\";i:1;s:3:\"bar\";i:2;s:11:\"foo bar you\";}
> 
> Notice: unserialize() [function.unserialize]: Error at offset 9 of 93 bytes 
> in
> 
> 
> ----- Original Message ----- 
> From: "Dan Cech" <dcech at phpwerx.net>
> To: "NYPHP Talk" <talk at lists.nyphp.org>
> Sent: Thursday, November 03, 2005 3:29 PM
> Subject: Re: [nycphp-talk] Offset error during unserializing data
> 
> 
> John,
> 
> You'll probably get some ideas if you post an example of a string
> causing the problem.
> 
> Dan
> 
> John Daly wrote:
>> All,
>>
>> I'm runing into an error when I try to unserialize array or object data,
>> shown below:
>>
>>  Notice: unserialize() [function.unserialize]: Error at offset 0 of 2060
>> bytes in ...
>>
>> I've looked online but yet haven't found anything to help me narrow it 
>> down.
>> Any ideas?
>>
>> thanks,
>>
>> JD



More information about the talk mailing list