[wp-trac] [WordPress Trac] #18488: set_transient crashes when value parameter is a SimpleXMLElement object
WordPress Trac
wp-trac at lists.automattic.com
Fri Aug 19 18:58:02 UTC 2011
#18488: set_transient crashes when value parameter is a SimpleXMLElement object
--------------------------+-----------------------------
Reporter: bobbingwide | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.2.1
Severity: normal | Keywords:
--------------------------+-----------------------------
I have been developing a plugin that obtains information about high and
low tides in the UK. The data is obtained from another site as a
SimpleXMLElement. I found that when I passed a value to set_transient that
had been assigned directly from the SimpleXMLObject then it was being
received as an object and somewhere in the innards of the function the
routine crashed. My workaround was to cast the assignment.
e.g. this failed
{{{
$title = $channel->item->title;
$store = '1';
$secs = bw_time_of_day_secs();
$secs = 86400 - $secs;
$set_transient( "bw_tides_title_" . $store, $title, $secs);
}}}
but change line 1 as below and it works
$title = '''(string)''' $channel->item->title;
Two questions therefore.
1. Am I misinterpreting the documentation that says I don't need to
serialise the value? What does mixed actually mean.
2. Does set_transient have to crash when the parameters are wrong?
The problem is completely reproducable. I now have a working solution so I
don't need a fix right now. I just want to understand.
Herb
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18488>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list