[wp-hackers] WordPress Transients API

Peter Westwood peter.westwood at ftwr.co.uk
Sat Jan 2 22:06:41 UTC 2010


On 2 Jan 2010, at 19:55, Pete Mall wrote:

> I'm having a problem with the WordPress transients API. I'm trying  
> to save a
> SimpleXMLElement Object and I don't think it is being stored  
> properly. Am I
> missing something or is there a problem handling SimpleXMLElement  
> Objects?
>
>
>   1. print_r <http://www.php.net/print_r>( $record ); // ==>
>   SimpleXMLElement Object ( [name] => www [data] => 111.111.111.111  
> [ttl] =>
>   86400 [aux] => 0 [id] => 111111 [zone-id] => 111111 [record-type]  
> => A
>   [active] => Y )
>   2. set_transient( 'my_transient_001', $record, 60*2 );
>   3. print_r <http://www.php.net/print_r>( get_transient(
>   'my_transient_001' ) ); // ==> SimpleXMLElement Object ( )

I think this is because the SimpleXMLElement objects don't support  
being serialized and unserialized.

At least that is the impression I get from here: http://php.net/manual/en/function.simplexml-load-string.php

Cheers

westi
-- 
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5



More information about the wp-hackers mailing list