Skip to content

Commit

Permalink
Fix #19130: Fix DbSession breaks in some case
Browse files Browse the repository at this point in the history
  • Loading branch information
longthanhtran committed Feb 8, 2022
1 parent 7a2689e commit 71e810c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Yii Framework 2 Change Log
- Bug #19204: Support numbers in Inflector::camel2words (longthanhtran)
- Bug #19004: Container::resolveCallableDependencies() unable to handle union and intersection types (sartor)
- Bug #19047: Fix deprecated preg_match() passing null parameters #2 in db\mysql\Schema.php (longthanhtran)
- Bug #19130: Fix DbSession breaks in some case (longthanhtran)


2.0.44 December 30, 2021
Expand Down
7 changes: 1 addition & 6 deletions framework/web/DbSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function regenerateID($deleteOldSession = false)
->queryOne();
});

if ($row !== false) {
if ($row !== false && $this->getIsActive()) {
if ($deleteOldSession) {
$this->db->createCommand()
->update($this->sessionTable, ['id' => $newID], ['id' => $oldID])
Expand All @@ -151,11 +151,6 @@ public function regenerateID($deleteOldSession = false)
->insert($this->sessionTable, $row)
->execute();
}
} else {
// shouldn't reach here normally
$this->db->createCommand()
->insert($this->sessionTable, $this->composeFields($newID, ''))
->execute();
}
}

Expand Down

0 comments on commit 71e810c

Please sign in to comment.