Re: simplexml and serialize error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux