Re: [PHP] simplexml and serialize error

2006-04-30 Thread Richard Lynch
On Sat, April 29, 2006 8:30 pm, Anthony Ettinger wrote:
 Warning: var_dump() [function.var-dump]: Node no longer exists in
 Foo.php on line 78
 object(SimpleXMLElement)#86 (0) { } [title]=

 I turn an xml string into a simplexml object, and then ran serialize()
 on it before caching the output locally. When I read it back in and
 run unserialize() to do a dump, I get this error.

WILD GUESS!!!

Whatever class objects you had defined before you serialized the data,
are not defined when you unserialize the data.

You need to load all your class files in both serialize and
unserialize scripts -- The class definition is not stored in
serialized data, just the class 'data'

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simplexml and serialize error

2006-04-30 Thread Jochem Maas

Richard Lynch wrote:

On Sat, April 29, 2006 8:30 pm, Anthony Ettinger wrote:


Warning: var_dump() [function.var-dump]: Node no longer exists in
Foo.php on line 78
object(SimpleXMLElement)#86 (0) { } [title]=

I turn an xml string into a simplexml object, and then ran serialize()
on it before caching the output locally. When I read it back in and
run unserialize() to do a dump, I get this error.



WILD GUESS!!!

Whatever class objects you had defined before you serialized the data,
are not defined when you unserialize the data.

You need to load all your class files in both serialize and
unserialize scripts -- The class definition is not stored in
serialized data, just the class 'data'



A DIFFERENT WILD GUESS!!! :-)

I don't think thats the problem - rather I get the impression that
there are references  (and or resources) inside these SimpleXML objects
(e.g. the owning 'document') that cannot be serialized. I would suggest
caching the xml string and read that from disk (or where ever your storing
stuff) and creating an object from that whenever you need it. I don't believe 
that
you gain much from serializing an object (as compared to creating a new object) 
-
when you unserialize you have pretty much the same overhead as when creating an 
object
(I may be very wrong on this! - I do know that cloning an object is _much_ 
faster than
creating one for instance).

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] simplexml and serialize error

2006-04-29 Thread Anthony Ettinger

Warning: var_dump() [function.var-dump]: Node no longer exists in
Foo.php on line 78
object(SimpleXMLElement)#86 (0) { } [title]=

I turn an xml string into a simplexml object, and then ran serialize()
on it before caching the output locally. When I read it back in and
run unserialize() to do a dump, I get this error.

--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php