There is a compatibility issue with the way views use blobs... There are places where %s is used instead of %b on blob fields. And nowhere is used db_decode_blob as in the drupal core.
The number of lines to be modified is very small so i'am attaching a patch.

Comments

aaaristo’s picture

uploading updated patch.. there was some debugging code left in the previous one..

merlinofchaos’s picture

It's my understanding that %b and blob handling only need to happen if the data is binary; serialized strings, which is what all of this uses, are text and therefore do not require blob decoding.

Crell’s picture

%b needs to be used if the field being stored into is of type BLOB, regardless of whether the data being stored is binary or string data. (Or rather, should be used. Whether or not the site will break on Postgres if you don't I am not sure. MySQL doesn't care either way.)

aaaristo’s picture

StatusFileSize
new3.14 KB

still some debug code cleanup

merlinofchaos’s picture

@@ -237,7 +237,7 @@ class views_handler_field_profile_date e
     if (!$value->{$this->field_alias}) {
       return;
     }
-    $value = unserialize($value->{$this->field_alias});
+    $value = unserialize(db_decode_blob($value->{$this->field_alias}));
     $format = $this->options['date_format'];
     switch ($format) {
       case 'custom':

I don't think this is right the profile_values table is not a blob.

aaaristo’s picture

StatusFileSize
new2.8 KB

ok removed.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

aaaristo’s picture

Version: 6.x-2.0-rc1 » 6.x-2.3
Status: Closed (fixed) » Active

Some one removed the db_decode_blob here:

includes/cache.inc line 214

views_object_cache_get :

function views_object_cache_get($obj, $name, $skip_cache = FALSE) {
static $cache = array();
$key = "$obj:$name";
if ($skip_cache) {
unset($cache[$key]);
}

if (!array_key_exists($key, $cache)) {
$data = db_fetch_object(db_query("SELECT * FROM {views_object_cache} WHERE sid = '%s' AND obj = '%s' AND name = '%s'", session_id(), $obj, $name));
if ($data) {
$cache[$key] = unserialize(db_decode_blob($data->data)); // <<<<<<<<<<<<<--------- must call db_decode_blob
}
}
return isset($cache[$key]) ? $cache[$key] : NULL;
}

merlinofchaos’s picture

Status: Active » Closed (fixed)

That one has already been removed in -dev.

aaaristo’s picture

Status: Closed (fixed) » Active

I checked the -dev and is still there:

this is buggy code -> $cache[$key] = unserialize($data->data);

The data column is a blob and the db_decode_blob should be used:

$cache[$key] = unserialize(db_decode_blob($data->data));

else will not work with pgsql and any other database that is not mysql.

merlinofchaos’s picture

views_object_cache has had its type changed from blob to text.

merlinofchaos’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.