mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
Fixes #15318: Fixed "session_name(): Cannot change session name when session is active" errors
This commit is contained in:
committed by
Alexander Makarov
parent
3c483a812f
commit
7473c422ee
@ -8,6 +8,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #15692: Fix ExistValidator with targetRelation ignores filter (developeruz)
|
||||
- Bug #15693: Fixed `yii\filters\auth\HttpHeaderAuth` to work correctly when pattern is set but was not matched (bboure)
|
||||
- Bug #15696: Fix magic getter for ActiveRecord (developeruz)
|
||||
- Bug #15318: Fixed "session_name(): Cannot change session name when session is active" errors (bscheshirwork, samdark)
|
||||
- Bug #15726: Fix ExistValidator is broken for NOSQL (developeruz)
|
||||
- Enh #15716: Implemented `\Traversable` in `yii\db\ArrayExpression` (silverfire)
|
||||
- Bug #15678: Fixed `resetForm()` method in `yii.activeForm.js` which used an undefined variable (Izumi-kun)
|
||||
|
||||
@ -322,7 +322,9 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
$this->freeze();
|
||||
session_name($value);
|
||||
$this->unfreeze();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -70,4 +70,22 @@ class SessionTest extends TestCase
|
||||
$this->assertNotEquals($oldGcProbability, $newGcProbability);
|
||||
$this->assertEquals(100, $newGcProbability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set name. Also check set name twice and after open
|
||||
*/
|
||||
public function testSetName()
|
||||
{
|
||||
$session = new Session();
|
||||
$session->setName('oldName');
|
||||
|
||||
$this->assertEquals('oldName', $session->getName());
|
||||
|
||||
$session->open();
|
||||
$session->setName('newName');
|
||||
|
||||
$this->assertEquals('newName', $session->getName());
|
||||
|
||||
$session->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user