From 0d53e86421faef0300d509b385934754b4dab88c Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 25 Apr 2016 10:23:06 +0200 Subject: add ISession::getId() wrapper for session_id --- lib/private/Session/CryptoSessionData.php | 10 ++++++++++ lib/private/Session/Internal.php | 10 ++++++++++ lib/private/Session/Memory.php | 10 ++++++++++ 3 files changed, 30 insertions(+) (limited to 'lib/private/Session') diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php index f6c585c1611..23731ef4560 100644 --- a/lib/private/Session/CryptoSessionData.php +++ b/lib/private/Session/CryptoSessionData.php @@ -141,6 +141,16 @@ class CryptoSessionData implements \ArrayAccess, ISession { $this->session->regenerateId($deleteOldSession); } + /** + * Wrapper around session_id + * + * @return string + * @since 9.1.0 + */ + public function getId() { + return $this->session->getId(); + } + /** * Close the session and release the lock, also writes all changed data in batch */ diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php index 09175bf1f2f..4fadb1ac801 100644 --- a/lib/private/Session/Internal.php +++ b/lib/private/Session/Internal.php @@ -111,6 +111,16 @@ class Internal extends Session { @session_regenerate_id($deleteOldSession); } + /** + * Wrapper around session_id + * + * @return string + * @since 9.1.0 + */ + public function getId() { + return @session_id(); + } + /** * @throws \Exception */ diff --git a/lib/private/Session/Memory.php b/lib/private/Session/Memory.php index 777458a9aa5..3dba274f395 100644 --- a/lib/private/Session/Memory.php +++ b/lib/private/Session/Memory.php @@ -88,6 +88,16 @@ class Memory extends Session { */ public function regenerateId($deleteOldSession = true) {} + /** + * Wrapper around session_id + * + * @return string + * @since 9.1.0 + */ + public function getId() { + throw new \Exception('Memory session does not have an ID'); + } + /** * Helper function for PHPUnit execution - don't use in non-test code */ -- cgit v1.2.3