Fix "PHP Warning: session_write_close(): Failed to write session data (user)" errors

- Changed returning true when there's a session ID but no session data
in ref_session_write()
- Moved session.php requires around
This commit is contained in:
Hypolite Petovan 2017-08-01 21:02:24 -04:00
commit 4601c4bd8a
6 changed files with 8 additions and 7 deletions

View file

@ -30,10 +30,14 @@ function ref_session_write($id, $data)
{
global $session_exists, $session_expire;
if (!$id || !$data) {
if (!$id) {
return false;
}
if (!$data) {
return true;
}
$expire = time() + $session_expire;
$default_expire = time() + 300;
@ -65,7 +69,7 @@ function ref_session_gc($expire)
{
q("DELETE FROM `session` WHERE `expire` < %d", dbesc(time()));
q("OPTIMIZE TABLE `sess_data`");
return true;
}