Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52e530d

Browse files
lyrixxfabpot
authored andcommitted
Fixed NativeSessionStorage:regenerate when does not exists
1 parent adde057 commit 52e530d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,13 @@ public function regenerate($destroy = false, $lifetime = null)
209209

210210
// workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
211211
session_write_close();
212-
$backup = $_SESSION;
213-
session_start();
214-
$_SESSION = $backup;
212+
if (isset($_SESSION)) {
213+
$backup = $_SESSION;
214+
session_start();
215+
$_SESSION = $backup;
216+
} else {
217+
session_start();
218+
}
215219

216220
return $ret;
217221
}

0 commit comments

Comments
 (0)