Sorry, didn't know cookies were plain text.

So serialization *should* work always, but it doesn't if you set the
encryption option to *off*.
I'm just sharing information trying to save others the hours I've spent with
this problem.
--
Baz L
Web Development 2.0: Web Design, CakePHP, Javascript
http://www.WebDevelopment2.com/

On Nov 12, 2007 11:31 AM, Ivolution <[EMAIL PROTECTED]> wrote:

>
> I agree with Grant Cox..
> You can't just write any variable to a cookie. With plaintext strings
> this works, but when you have complex datatypes like multidimensional
> arrays, you have to convert it somehow to a plaintext string.
> This is exactly where the serialize() function kicks in: the only
> thing this function does is generate a storable representation
> (plaintext string) of any value.
> So there's no encryption involved at all (though it looks encrypted if
> you look at the value). If you want to encrypt your information (seems
> to be a good thing since it's about user-logins), you should serialize
> your array, and then encrypt it's output before you pass it to the
> cookie. When retrieving the cookie, it's obviously the other way
> round.
>
>
> On Nov 12, 5:43 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> > The reason it works in the first controller is because it is not
> > reading from the cookie itself - it also saves the data to a local
> > variable and it is reading back from that.  Because there is no
> > automatic serialization going on, only strings are written to the
> > cookie - so a complex data type will never work in your second
> > controller (or after refreshing the page, or whatever so that it does
> > actually read the cookie).
> >
> > I can't think of any reason that it would not work without encryption
> > though...
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to