Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added Session::id() method, returns NULL by default, overloaded in da…
…tabase and native sessions, fixes #3068
  • Loading branch information
Woody Gilk committed Jul 14, 2010
1 parent 0c6c357 commit f67b07a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions classes/kohana/session.php
Expand Up @@ -159,6 +159,21 @@ public function & as_array()
return $this->_data;
}

/**
* 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.
*
Expand Down
5 changes: 5 additions & 0 deletions classes/kohana/session/native.php
Expand Up @@ -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
Expand Down

0 comments on commit f67b07a

Please sign in to comment.