diff --git a/lib/Horde/Prefs/Storage/Sql.php b/lib/Horde/Prefs/Storage/Sql.php index c0d4bbd..9c6a425 100644 --- a/lib/Horde/Prefs/Storage/Sql.php +++ b/lib/Horde/Prefs/Storage/Sql.php @@ -13,6 +13,8 @@ * @package Prefs */ +use Horde\Util\HordeString; + /** * Preferences storage implementation for a SQL database. * @@ -125,8 +127,12 @@ public function store($scope_ob) throw new Horde_Prefs_Exception($e); } - /* Driver has no support for storing locked status. */ - $value = Horde_String::convertCharset($value, 'UTF-8', $charset); + /* Driver has no support for storing locked status. + * strval() before charset conversion so non-string scalars + * (e.g. integer 0/1 from checkbox prefs) are normalized + * before reaching the PDO blob layer, which serializes + * string data only. */ + $value = HordeString::convertCharset(strval($value), 'UTF-8', $charset); $value = new Horde_Db_Value_Binary($value); if (empty($check)) {