Re: Serializing Session variables. Cuts off after a given length????

From: Ken Robinson (kenrbnsn_at_rbnsn.com)
Date: 09/30/04


Date: 30 Sep 2004 13:15:17 -0700

Ryan Hubbard wrote:
> I've have been trying to serialize an array of objects. I can
> serialize and set a session variable and retrieve it successfully for
> a serialize string of any length within the contents of a single
> script.
>
> $_SESSION['a'] = serialize($b); // strlen($a) = 120,011
> print unserialize($_SESSION['a'])
>
>

Why are you serializing the array? You can just do a $_SESSION['a'] =
$b;

Data is automatically serialized when it is inserted into a SESSION. So
the session variable really has a serialized serialized array.

I don't know if not serializing the array before you store it will
help, but it's worth a shot.

Ken



Relevant Pages

  • Re: Serializing data set with de-normalized data
    ... You have very limited ability to affect the XML output and the only things ... array, you'll need to create each of those values and separate them with ... some delimmiter and ultimately treat them as one value. ... ComplexType and define your own effective Array, that should serialize ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: serialize only a litte part?
    ... BAIS: byte array input stream ... BAOS: byte array output stream ... Yes you can serialize only a part. ...
    (comp.lang.java.programmer)
  • Re: Serialize/DeSerialize Generics List
    ... a bit of a brain fart there: I said "Deserialize" when I meant ... "Serialize" a bunch of times. ... from Array. ... converted to-and-from your hidden List property (converting from lists ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Dynamic serialization of objects with lists or pointers as members
    ... referenced by a pointer to the base class, ... And some of these classes have an array as a member. ... 1- If I want to call each object's serialize() function, ... thenI don't know what will happen when I try to store ...
    (microsoft.public.vc.mfc)
  • Serialize and Unserializa weird behaviour
    ... I found a strange behaviour using serialize and unserialize to persist ... to file a configuration array. ... I'm using a flat text file to store configuration information. ...
    (php.general)