fixed a bug where a PHP error would result when passing objects as values to the Session class
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index bd94268..cf6dc96 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -680,12 +680,18 @@
{
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 @@
{
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;
}
// --------------------------------------------------------------------