summaryrefslogtreecommitdiffstats
path: root/system/libraries/Session.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2011-10-20 08:22:12 +0200
committerAndrey Andreev <narf@bofh.bg>2011-10-20 08:22:12 +0200
commitd8442dd015d9e16929825bc51f3cac25c2f74c73 (patch)
treeb9d1a059683b0e31cf056150cc375941a91be252 /system/libraries/Session.php
parent56b21e1233855e9ea87ece7bb92e7994042b9cb3 (diff)
parent9fca615492ba481f5c27890b3b61f0603f45c55b (diff)
Merge remote-tracking branch 'upstream/develop' into ci-oci8-driver-php5
Diffstat (limited to 'system/libraries/Session.php')
-rw-r--r--system/libraries/Session.php48
1 files changed, 32 insertions, 16 deletions
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 8ee08c5b2..867314bf9 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -688,13 +688,7 @@ class CI_Session {
{
if (is_array($data))
{
- foreach ($data as $key => $val)
- {
- if (is_string($val))
- {
- $data[$key] = str_replace('\\', '{{slash}}', $val);
- }
- }
+ array_walk_recursive($data, array(&$this, '_escape_slashes'));
}
else
{
@@ -703,9 +697,23 @@ class CI_Session {
$data = str_replace('\\', '{{slash}}', $data);
}
}
-
return serialize($data);
}
+
+ /**
+ * Escape slashes
+ *
+ * This function converts any slashes found into a temporary marker
+ *
+ * @access private
+ */
+ function _escape_slashes(&$val, $key)
+ {
+ if (is_string($val))
+ {
+ $val = str_replace('\\', '{{slash}}', $val);
+ }
+ }
// --------------------------------------------------------------------
@@ -725,19 +733,27 @@ class CI_Session {
if (is_array($data))
{
- foreach ($data as $key => $val)
- {
- if (is_string($val))
- {
- $data[$key] = str_replace('{{slash}}', '\\', $val);
- }
- }
-
+ array_walk_recursive($data, array(&$this, '_unescape_slashes'));
return $data;
}
return (is_string($data)) ? str_replace('{{slash}}', '\\', $data) : $data;
}
+
+ /**
+ * Unescape slashes
+ *
+ * This function converts any slash markers back into actual slashes
+ *
+ * @access private
+ */
+ function _unescape_slashes(&$val, $key)
+ {
+ if (is_string($val))
+ {
+ $val= str_replace('{{slash}}', '\\', $val);
+ }
+ }
// --------------------------------------------------------------------