Permalink
Browse files

Added Session::id() method, returns NULL by default, overloaded in da…

…tabase and native sessions, fixes #3068
  • Loading branch information...
1 parent 0c6c357 commit f67b07a69c4e16027ac52fda7a0747c510eee164 @shadowhand shadowhand committed Jul 14, 2010
Showing with 20 additions and 0 deletions.
  1. +15 −0 classes/kohana/session.php
  2. +5 −0 classes/kohana/session/native.php
View
@@ -160,6 +160,21 @@ public function & as_array()
}
/**
+ * Get the current session id, if the session supports it.
+ *
+ * $id = $session->id();
+ *
+ * [!!] Not all session types have ids.
+ *
+ * @return string
+ * @since 3.0.8
+ */
+ public function id()
+ {
+ return NULL;
+ }
+
+ /**
* Get a variable from the session array.
*
* $foo = $session->get('foo');
@@ -10,6 +10,11 @@
*/
class Kohana_Session_Native extends Session {
+ public function id()
+ {
+ return session_id();
+ }
+
protected function _read($id = NULL)
{
// Set the cookie lifetime

0 comments on commit f67b07a

Please sign in to comment.