NYCPHP Meetup

NYPHP.org

[nycphp-talk] Offset error during unserializing data

John Daly jdaly at panix.com
Thu Nov 3 16:16:51 EST 2005


Aha,  I found the error.  Dang it.

   if ($form->validate())
      {
        //$form->applyFilter('__ALL__', 'addslashes');
        //$form->applyFilter('__ALL__', 'htmlentities');
        $form->process('do_action', true);
      }

I forgot about those. The serialized string was assigned to a hidden 
variable and Quickform was applying the rules.  Commented out everything 
works fine.

Thanks for the input,

JD

----- Original Message ----- 
From: "Dan Cech" <dcech at phpwerx.net>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Thursday, November 03, 2005 3:52 PM
Subject: Re: [nycphp-talk] Offset error during unserializing data


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
_______________________________________________
New York PHP Talk Mailing List
AMP Technology
Supporting Apache, MySQL and PHP
http://lists.nyphp.org/mailman/listinfo/talk
http://www.nyphp.org 




More information about the talk mailing list