diff options
Diffstat (limited to 'lib/private/Session/Internal.php')
-rw-r--r-- | lib/private/Session/Internal.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php index 09175bf1f2f..a24aec55222 100644 --- a/lib/private/Session/Internal.php +++ b/lib/private/Session/Internal.php @@ -26,6 +26,8 @@ namespace OC\Session; +use OCP\Session\Exceptions\SessionNotAvailableException; + /** * Class Internal * @@ -112,6 +114,21 @@ class Internal extends Session { } /** + * Wrapper around session_id + * + * @return string + * @throws SessionNotAvailableException + * @since 9.1.0 + */ + public function getId() { + $id = @session_id(); + if ($id === '') { + throw new SessionNotAvailableException(); + } + return $id; + } + + /** * @throws \Exception */ public function reopen() { |