Fix unserialization

This commit is contained in:
Romain Neutron
2012-01-04 22:43:44 +01:00
parent f5be57c202
commit 096d6e4002

View File

@@ -39,56 +39,67 @@ class searchEngine_options implements Serializable
* @var string * @var string
*/ */
protected $record_type; protected $record_type;
/** /**
* *
* @var string * @var string
*/ */
protected $search_type = 0; protected $search_type = 0;
/** /**
* *
* @var array * @var array
*/ */
protected $bases = array(); protected $bases = array();
/** /**
* *
* @var array * @var array
*/ */
protected $fields = array(); protected $fields = array();
/** /**
* *
* @var array * @var array
*/ */
protected $status = array(); protected $status = array();
/** /**
* *
* @var DateTime * @var DateTime
*/ */
protected $date_min; protected $date_min;
/** /**
* *
* @var DateTime * @var DateTime
*/ */
protected $date_max; protected $date_max;
/** /**
* *
* @var array * @var array
*/ */
protected $date_fields = array(); protected $date_fields = array();
/** /**
* *
* @var string * @var string
*/ */
protected $i18n; protected $i18n;
/** /**
* *
* @var boolean * @var boolean
*/ */
protected $stemming = true; protected $stemming = true;
/** /**
* *
* @var string * @var string
*/ */
protected $sort_by = self::SORT_CREATED_ON; protected $sort_by = self::SORT_CREATED_ON;
/** /**
* *
* @var string * @var string
@@ -267,12 +278,12 @@ class searchEngine_options implements Serializable
continue; continue;
if (isset($options['on'])) if (isset($options['on']))
{ {
foreach($options['on'] as $sbas_id) foreach ($options['on'] as $sbas_id)
$tmp[$n][$sbas_id] = 1; $tmp[$n][$sbas_id] = 1;
} }
if (isset($options['off'])) if (isset($options['off']))
{ {
foreach($options['off'] as $sbas_id) foreach ($options['off'] as $sbas_id)
$tmp[$n][$sbas_id] = 0; $tmp[$n][$sbas_id] = 0;
} }
} }
@@ -433,6 +444,8 @@ class searchEngine_options implements Serializable
{ {
if (in_array($key, array('date_min', 'date_max'))) if (in_array($key, array('date_min', 'date_max')))
$value = new DateTime($value); $value = new DateTime($value);
elseif ($value instanceof stdClass)
$value = (array) $value;
$this->$key = $value; $this->$key = $value;
} }