mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 22:34:24 +02:00
Merge pull request #3209 from Icinga/bugfix/warnings-for-php-7-1-3208
PhpSession: conform to PHP 7.1
This commit is contained in:
commit
89da30f05f
@ -33,20 +33,6 @@ class PhpSession extends Session
|
|||||||
*/
|
*/
|
||||||
protected $sessionName = 'Icingaweb2';
|
protected $sessionName = 'Icingaweb2';
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration for cookie options
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected static $defaultCookieOptions = array(
|
|
||||||
'use_trans_sid' => false,
|
|
||||||
'use_cookies' => true,
|
|
||||||
'cookie_httponly' => true,
|
|
||||||
'use_only_cookies' => true,
|
|
||||||
'hash_function' => true,
|
|
||||||
'hash_bits_per_character' => 5,
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPSession object using the provided options (if any)
|
* Create a new PHPSession object using the provided options (if any)
|
||||||
*
|
*
|
||||||
@ -57,10 +43,24 @@ class PhpSession extends Session
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $options = null)
|
public function __construct(array $options = null)
|
||||||
{
|
{
|
||||||
if ($options !== null) {
|
$defaultCookieOptions = array(
|
||||||
$options = array_merge(self::$defaultCookieOptions, $options);
|
'use_trans_sid' => false,
|
||||||
|
'use_cookies' => true,
|
||||||
|
'cookie_httponly' => true,
|
||||||
|
'use_only_cookies' => true
|
||||||
|
);
|
||||||
|
|
||||||
|
if (version_compare(PHP_VERSION, '7.1.0') < 0) {
|
||||||
|
$defaultCookieOptions['hash_function'] = true;
|
||||||
|
$defaultCookieOptions['hash_bits_per_character'] = 5;
|
||||||
} else {
|
} else {
|
||||||
$options = self::$defaultCookieOptions;
|
$defaultCookieOptions['sid_bits_per_character'] = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($options !== null) {
|
||||||
|
$options = array_merge($defaultCookieOptions, $options);
|
||||||
|
} else {
|
||||||
|
$options = $defaultCookieOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('test_session_name', $options)) {
|
if (array_key_exists('test_session_name', $options)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user