mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°8286 - fix call to CompleteSessionData in case of no proper session content
This commit is contained in:
@@ -147,7 +147,7 @@ class SessionHandler extends \SessionHandler
|
||||
$iCreationTime = $aJson['creation_time'];
|
||||
}
|
||||
} else {
|
||||
IssueLog::Debug(__METHOD__ . ': not a json due (session file corruption?)', null, [ 'sPreviousFileVersionContent' => $sPreviousFileVersionContent ]);
|
||||
$aJson=[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -316,4 +316,13 @@ class SessionHandlerTest extends ItopDataTestCase
|
||||
|
||||
$this->assertEquals('gabuzomeu', $aJson['shadok'] ?? '', "Should report the current login mode in [shadok]: $sFirstContent");
|
||||
}
|
||||
|
||||
public function testGenerateSessionContentWithPreviousNonArrayContentAndWithAdditionalDataProvidedBySessionHandlerExtension()
|
||||
{
|
||||
\utils::GetConfig()->Set('sessions_tracking.session_handler_extension', 'Combodo\iTop\Test\UnitTest\SessionTracker\BasicSessionHandlerExtension');
|
||||
$this->CreateUserAndLogIn();
|
||||
$oSessionHandler = new SessionHandler();
|
||||
$sContent = $this->GenerateSessionContent($oSessionHandler, json_encode(null));
|
||||
$this->assertNotNull($sContent, "Call to CompleteSessionData should NOT fail due to Argument #1 (\$aJson) must be of type array, null given");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user