Zen Cart Logo
Forums / Bug Reports / [Done v1.3.9a] UTF-8 session and cache problems

[Done v1.3.9a] UTF-8 session and cache problems

Locked

Views: 2,741

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
11 Nov 2009, 3:47 PM
#1
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Location:
Saint Petersburg, Russia
Posts:
1,782
Plugin Contributions:
5

[Done v1.3.9a] UTF-8 session and cache problems

Hi,
I have a problems with session and cache when they stored in db.
zen-cart 1.3.8a
MySQL 5.1.33-log, PHP: 5.2.10 (Zend: 2.2.0)
MySQL 5.0.18-max-log, PHP: 5.2.1 (Zend: 2.2.0)

Both fields TABLE_DB_CACHE'[cache_data'] and TABLE_SESSIONS['value'] are mediumblob.

The problem arises only when write/read information containing characters in utf-8.

My solution.

includes/functions/sessions.php
Find ~43 line

if (isset($value->fields['value']) && $value->fields['value']) {

Add after

$value->fields['value'] = base64_decode($value->fields['value']);

Find ~62 line

$value = $val;

Add after

$value = base64_encode($value);

includes/classes/cache.php
Find ~127 line

$result_serialize = $db->prepare_input(serialize($zf_result_array));

Add after

$result_serialize = base64_encode($result_serialize);

Find ~155 line

$zp_cache_result = $db->Execute($sql);

Add after

$zp_cache_result->fields['cache_data'] = base64_decode($zp_cache_result->fields['cache_data']);
30 Nov 2009, 4:04 PM
#2
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Location:
Saint Petersburg, Russia
Posts:
1,782
Plugin Contributions:
5

Re: [Done v1.3.9a] UTF-8 session and cache problems

Both files need to edit - in the shop and in the admin. You also need to edit the admin/whos_online.php:
Find

$session_data = trim($session_data->fields['value']);

add after

$session_data = base64_decode($session_data);