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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ryan Hubbard

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

    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($_S ESSION['a'])


    But if I set a session variable and then try to access it on another
    page the session variable is always truncated at 67,789 in length. So
    the unserialize function cannot correctly interrupt the variable. Why
    are my serialized session variables truncated at 67,789???

    Thanks
  • Ken Robinson

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

    Ryan Hubbard wrote:[color=blue]
    > 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($_S ESSION['a'])
    >
    >[/color]

    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

    Comment

    Working...