Closed (fixed)
Project:
Chaos Tool Suite (ctools)
Version:
7.x-1.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 May 2012 at 20:22 UTC
Updated:
17 May 2012 at 21:21 UTC
I'm using the ctools object cache in an ajax callback to store data so it is available later in a Solr hook. The data is stored fine in the table when I call ctools_object_cache_set(), but when I retrieve the data with ctools_object_cache_get(), I just get an empty object. In stepping through the ctools_object_cache_set() code, it chokes when it tries to unserialize the data. Here is the code I'm using to serialize it:
foreach ($form_state['values'] as $id => $tids) {
if (substr($id, 0, 6) == 'vocab_') {
$vid = substr($id, 6);
$filters = new stdClass();
foreach ($tids as $tid) {
if ($tid) {
$filters->{$tid} = $tid;
}
}
// Cache the object in ctools cache so it's available later.
ctools_include('object-cache');
ctools_object_cache_set('solr_filters', $id, $filters);
}
}
Is there something I'm doing in creating my object that's causing the problem? This is my first time using ctools object caching, so there's always that possibility.
Thanks.
Comments
Comment #1
wonder95 commentedThe problem was that I was using an integer as a property in my $filters object. Once I changed it to
the retrieving worked fine.