[mapserver-users] PHP MapObj serialization?

Vinko Vrsalovic vinko at cprsig.cl
Mon Jul 29 22:44:46 PDT 2002


Hello, 

	I'm trying to serialize a PHP MapObj for further use (another
	page from the same session).

	From what I've read, this will not work if you don't have the
	definition of the class in all the pages the object will be
	used.

	I also presume that dl'ing the .so is not what is meant by
	definition of the class. Is serializing and/or saving in a
	session variable the mapobj possible?

	Ex:

	p1.php
	<?php
	dl('php_mapscript.so');
	session_start();
	$map = ms_newMapObj("file.map");
	$map->draw();

	$_SESSION['map'] = $map; 
	/* or
	$_SESSION['map'] = serialize($map);
	*/

	?>

	p2.php
	<?php
	dl('php_mapscript.so');
	session_start();
	$map = $_SESSION['map'];
	/* or
	$map = unserialize($_SESSION['map']);
	*/

	?>

	As I understood from the docs the serialization is not needed when
	using $_SESSION.

	If i serialize/unserialize, i get the long forgotten:

	Fatal error: Object has an invalid _handle_ property in ...

	If i don't serialize/unserialize, i get the same error. :)
	
	Is there a trick to make PHP see the MapObj definition?

Thanks,
-- 
Vinko Vrsalovic <vinko[|- at -|]cprsig.cl>
http://www.cprsig.cl



More information about the MapServer-users mailing list