[eluser]eyupci[/eluser]
Okay I fixed the problem and see that there are some other topics that are very related. My CI version is 1.7.1 and when I looked the latest file in subversion, there is still this problem.
To reproduce the bug configure your session storing as database and make an array with two or more dimensions. And save it to session. After refresh or go another page, you'll see that your session data is gone and you'll see unserialize errors in log.
In Session.php library there are two functions _serialize and _unserialize. Codeigniter guys hopefully think slash character ('\') can cause problems but it's not enough
Code:
#Session.php File
function _serialize($data)
{
if (is_array($data))
{
foreach ($data as $key => $val) {
$data[$key] = str_replace('\\', '{{slash}}', $val);
}
}else {
$data = str_replace('\\', '{{slash}}', $data);
}
return serialize($data);
}
As you see there is a check for being array of coming data. However it only replace slashes for only one level of array.
If your data like:
$array['index1']['index2']['index3'] = '\ illegal slash character'
Than this function will not replace slash character with {{slash}} string. Then unserialize method will not work. Blow Session(!)
Same problem is also exists in _unserialize function. So you should modify these functions and have to write a recursive function to replace slash characters. That's my quick solution and works fine.