Skip to content

Commit f383655

Browse files
committed
✨ added generating of sessions
1 parent 20a3344 commit f383655

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Http/Session.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,20 @@ public static function id($id = null)
186186
}
187187

188188
/**
189-
* Regenerate the session id
189+
* Regenerate the session id/Generate a new session if none exists
190190
*
191191
* @param bool $clearData: Clear all session data?
192192
*
193193
* @return bool True on success, false on failure
194194
*/
195195
public static function regenerate($clearData = false)
196196
{
197+
if (!isset($_SESSION)) {
198+
session_start();
199+
static::id();
200+
return true;
201+
}
202+
197203
return session_regenerate_id($clearData);
198204
}
199205

0 commit comments

Comments
 (0)