note 77868 deleted from function.simplexml-load-string by cmb
| From: | cmb@php.net | Date: | Sun, 15 Dec 2019 10:10:36 +0000 |
| Subject: | note 77868 deleted from function.simplexml-load-string by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213526@lists.php.net to get a copy of this message | ||
Note Submitter: hattori at hanso dot com
----
If you want to serialize and unserialize SimpleXMLElement objects for caching, you need to transform
the SimpleXMLElement object into a standard class object before unserializing.
This is only if you want to cache converted data, the functionallity of the SimpleXMLElement will
not be held.
$content = '<SomeXML....'
$serialized = str_replace(
array('O:16:"SimpleXMLElement":0:{}',
'O:16:"SimpleXMLElement":'),
array('s:0:"";', 'O:8:"stdClass":'),
serialize(simplexml_load_string($content))
);
$unserialized = unserialize($serialized);