mirror of
https://github.com/yiisoft/yii.git
synced 2026-02-20 01:21:22 +01:00
Fixed code formatting to match Yii 1 coding style
This commit is contained in:
@@ -7,10 +7,10 @@ Yii::import('system.web.CHttpSession');
|
||||
*/
|
||||
class CustomStorageSession extends CHttpSession
|
||||
{
|
||||
public function getUseCustomStorage()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function getUseCustomStorage()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class CHttpSessionTest extends CTestCase {
|
||||
@@ -50,41 +50,45 @@ class CHttpSessionTest extends CTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On PHP 8.4+, using custom storage should not trigger a
|
||||
* session_set_save_handler() deprecation anymore.
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testCustomStorageDoesNotTriggerSessionSetSaveHandlerDeprecationOnPhp84()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '8.4', '<')) {
|
||||
$this->markTestSkipped('session_set_save_handler() deprecation is PHP 8.4+ only.');
|
||||
}
|
||||
/**
|
||||
* On PHP 8.4+, using custom storage should not trigger a
|
||||
* session_set_save_handler() deprecation anymore.
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testCustomStorageDoesNotTriggerSessionSetSaveHandlerDeprecationOnPhp84()
|
||||
{
|
||||
if(version_compare(PHP_VERSION, '8.4', '<'))
|
||||
{
|
||||
$this->markTestSkipped('session_set_save_handler() deprecation is PHP 8.4+ only.');
|
||||
}
|
||||
|
||||
$deprecationTriggered = false;
|
||||
set_error_handler(function ($errno, $errstr) use (&$deprecationTriggered) {
|
||||
if ($errno === E_DEPRECATED && strpos($errstr, 'session_set_save_handler') !== false) {
|
||||
$deprecationTriggered = true;
|
||||
}
|
||||
return false;
|
||||
}, E_DEPRECATED);
|
||||
$deprecationTriggered=false;
|
||||
set_error_handler(function ($errno, $errstr) use (&$deprecationTriggered)
|
||||
{
|
||||
if($errno === E_DEPRECATED && strpos($errstr, 'session_set_save_handler') !== false)
|
||||
{
|
||||
$deprecationTriggered=true;
|
||||
}
|
||||
return false;
|
||||
}, E_DEPRECATED);
|
||||
|
||||
$session = new CustomStorageSession();
|
||||
$session->setCookieMode('none');
|
||||
$session->setSavePath(sys_get_temp_dir());
|
||||
$session->setSessionName('CHttpSessionPhp84Test');
|
||||
$session->setTimeout(5);
|
||||
$session=new CustomStorageSession();
|
||||
$session->setCookieMode('none');
|
||||
$session->setSavePath(sys_get_temp_dir());
|
||||
$session->setSessionName('CHttpSessionPhp84Test');
|
||||
$session->setTimeout(5);
|
||||
|
||||
$session->open();
|
||||
$session->open();
|
||||
|
||||
$this->assertNotSame('', session_id());
|
||||
$this->assertFalse($deprecationTriggered, 'session_set_save_handler() deprecation was triggered');
|
||||
$this->assertNotSame('', session_id());
|
||||
$this->assertFalse($deprecationTriggered, 'session_set_save_handler() deprecation was triggered');
|
||||
|
||||
if (session_id() !== '') {
|
||||
$session->close();
|
||||
}
|
||||
restore_error_handler();
|
||||
}
|
||||
if(session_id() !== '')
|
||||
{
|
||||
$session->close();
|
||||
}
|
||||
restore_error_handler();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user