We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 20a3344 commit f383655Copy full SHA for f383655
src/Http/Session.php
@@ -186,14 +186,20 @@ public static function id($id = null)
186
}
187
188
/**
189
- * Regenerate the session id
+ * Regenerate the session id/Generate a new session if none exists
190
*
191
* @param bool $clearData: Clear all session data?
192
193
* @return bool True on success, false on failure
194
*/
195
public static function regenerate($clearData = false)
196
{
197
+ if (!isset($_SESSION)) {
198
+ session_start();
199
+ static::id();
200
+ return true;
201
+ }
202
+
203
return session_regenerate_id($clearData);
204
205
0 commit comments