From 133e66626bb410571a8350376d3f81ed8bc9143f Mon Sep 17 00:00:00 2001
From: Derek Jones
Date: Mon, 29 Mar 2010 11:36:42 -0500
Subject: fixed a bug where a PHP error would result when passing objects as
values to the Session class
---
system/libraries/Session.php | 17 +++++++++++++----
user_guide/changelog.html | 1 +
2 files changed, 14 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;
}
// --------------------------------------------------------------------
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 3006de753..dff273d9d 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -153,6 +153,7 @@ Hg Tag:
Fixed a bug (#10470) where get_mime_by_extension() was case sensitive.
Fixed a bug where some error messages for the SQLite and Oracle drivers would not display.
Fixed a bug where files created with the Zip Library would result in file creation dates of 1980.
+ Fixed a bug in the Session library that would result in PHP error when attempting to store values with objects.
Fixed a bug where extending the Controller class would result in a fatal PHP error.
--
cgit v1.2.3-24-g4f1b