From: <var...@us...> - 2020-03-23 13:06:04
|
Revision: 10158 http://sourceforge.net/p/phpwiki/code/10158 Author: vargenau Date: 2020-03-23 13:06:02 +0000 (Mon, 23 Mar 2020) Log Message: ----------- fix dba session storage for IPv6 addresses -- patches by Christof Meerwald Modified Paths: -------------- trunk/lib/DbSession/dba.php Modified: trunk/lib/DbSession/dba.php =================================================================== --- trunk/lib/DbSession/dba.php 2020-03-23 13:03:24 UTC (rev 10157) +++ trunk/lib/DbSession/dba.php 2020-03-23 13:06:02 UTC (rev 10158) @@ -125,7 +125,7 @@ if (!$result) { return false; } - list(, , $packed) = explode(':', $result, 3); + list(, , $packed) = explode('|', $result, 3); $this->_disconnect(); if (strlen($packed) > 4000) { // trigger_error("Overlarge session data!", E_USER_WARNING); @@ -166,7 +166,7 @@ trigger_error("Overlarge session data!", E_USER_WARNING); $sess_data = ''; } - $dbh->set($id, $time . ':' . $ip . ':' . $sess_data); + $dbh->set($id, $time . '|' . $ip . '|' . $sess_data); $this->_disconnect(); return true; } @@ -189,12 +189,14 @@ { $dbh = $this->_connect(); $threshold = time() - $maxlifetime; - for ($id = $dbh->firstkey(); $id !== false; $id = $dbh->nextkey()) { + for ($id = $dbh->firstkey(); $id !== false; $id = $nextid) { $result = $dbh->get($id); - list($date, ,) = explode(':', $result, 3); + list($date, ,) = explode('|', $result, 3); + $nextid = $dbh->nextkey(); if ($date < $threshold) $dbh->delete($id); } + $dbh->optimize(); $this->_disconnect(); return true; } @@ -207,7 +209,7 @@ $dbh = $this->_connect(); for ($id = $dbh->firstkey(); $id !== false; $id = $dbh->nextkey()) { $result = $dbh->get($id); - list($date, $ip, $packed) = explode(':', $result, 3); + list($date, $ip, $packed) = explode('|', $result, 3); if (!$packed) continue; // session_data contains the <variable name> + "|" + <packed string> // we need just the wiki_user object (might be array as well) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |