[mapserver-users] serializing mapobject with php (FWD)
Daniel Morissette
morissette at dmsolutions.ca
Wed Apr 24 06:42:05 PDT 2002
> From: "Vincent Jansen" <vincent.jansen at javel.nl>
>
> Hi,
>
> I've been trying to store a complete mapObject in the session vars in php.
> Every time I try to perform a task on the unserialized object I get
>
> Fatal error: Object has an invalid _handle_ property in ....
>
Vincent,
You cannot serialize a mapObj or any PHP MapScript object... this is
because those objects are not pure PHP objects, they are really just
wrappers on top of the MapServer C data structures, and PHP serializes
only the PHP wrapper but not the underlying C objects... that's why you
get this error.
So you'll have to either reload the original map using ms_newMapObj() in
every request and reapply your changes to the mapObj in every request,
or if the number of changes is very large and this is not an option,
then you can save the mapObj to a temporary file using
$map->save("/tmp/tmp123.map"), and store the temp filename in your
session variables and reload the temp mapfile at the beginning of the
next request.
--
------------------------------------------------------------
Daniel Morissette morissette at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
Don't put for tomorrow what you can do today, because if
you enjoy it today you can do it again tomorrow.
More information about the MapServer-users
mailing list