diff options
author | Derek Jones <derek.jones@ellislab.com> | 2010-03-29 18:36:42 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2010-03-29 18:36:42 +0200 |
commit | 133e66626bb410571a8350376d3f81ed8bc9143f (patch) | |
tree | cba4340c0355f73b63b1a405779621820e883d61 /system/libraries/Session.php | |
parent | d6d70e327b74018ab1cd59185a0dc970cd0711be (diff) |
fixed a bug where a PHP error would result when passing objects as values to the Session class
Diffstat (limited to 'system/libraries/Session.php')
-rw-r--r-- | system/libraries/Session.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/system/libraries/Session.php b/system/libraries/Session.php index bd9426818..cf6dc96e3 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -680,12 +680,18 @@ class CI_Session { { foreach ($data as $key => $val) { - $data[$key] = str_replace('\\', '{{slash}}', $val); + if (is_string($val)) + { + $data[$key] = str_replace('\\', '{{slash}}', $val); + } } } else { - $data = str_replace('\\', '{{slash}}', $data); + if (is_string($data)) + { + $data = str_replace('\\', '{{slash}}', $data); + } } return serialize($data); @@ -711,13 +717,16 @@ class CI_Session { { foreach ($data as $key => $val) { - $data[$key] = str_replace('{{slash}}', '\\', $val); + if (is_string($val)) + { + $data[$key] = str_replace('{{slash}}', '\\', $val); + } } return $data; } - return str_replace('{{slash}}', '\\', $data); + return (is_string($data)) ? str_replace('{{slash}}', '\\', $data) : $data; } // -------------------------------------------------------------------- |