set_transient crashes when value parameter is a SimpleXMLElement object
|Reported by:||bobbingwide||Owned by:||wonderboymusic|
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.
- Am I misinterpreting the documentation that says I don't need to serialise the value? What does mixed actually mean.
- 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.
Change History (22)
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
comment:10 mikeschinkel — 20 months ago
- Cc mikeschinkel@… added
- Keywords dev-feedback added
- Resolution invalid deleted
- Status changed from closed to reopened
- Type changed from defect (bug) to enhancement
comment:19 wonderboymusic — 8 months ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 3.7