updated packages
This commit is contained in:
@@ -104,7 +104,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
|
||||
{
|
||||
if (null === $this->igbinaryEmptyData) {
|
||||
// see https://github.com/igbinary/igbinary/issues/146
|
||||
$this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : '';
|
||||
$this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize([]) : '';
|
||||
}
|
||||
if ('' === $data || $this->igbinaryEmptyData === $data) {
|
||||
return $this->destroy($sessionId);
|
||||
|
||||
@@ -45,11 +45,11 @@ class MemcachedSessionHandler extends AbstractSessionHandler
|
||||
*
|
||||
* @throws \InvalidArgumentException When unsupported options are passed
|
||||
*/
|
||||
public function __construct(\Memcached $memcached, array $options = array())
|
||||
public function __construct(\Memcached $memcached, array $options = [])
|
||||
{
|
||||
$this->memcached = $memcached;
|
||||
|
||||
if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) {
|
||||
if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) {
|
||||
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff)));
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
return true;
|
||||
return $this->memcached->quit();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,12 +74,12 @@ class MongoDbSessionHandler extends AbstractSessionHandler
|
||||
|
||||
$this->mongo = $mongo;
|
||||
|
||||
$this->options = array_merge(array(
|
||||
$this->options = array_merge([
|
||||
'id_field' => '_id',
|
||||
'data_field' => 'data',
|
||||
'time_field' => 'time',
|
||||
'expiry_field' => 'expires_at',
|
||||
), $options);
|
||||
], $options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,9 +95,9 @@ class MongoDbSessionHandler extends AbstractSessionHandler
|
||||
*/
|
||||
protected function doDestroy($sessionId)
|
||||
{
|
||||
$this->getCollection()->deleteOne(array(
|
||||
$this->getCollection()->deleteOne([
|
||||
$this->options['id_field'] => $sessionId,
|
||||
));
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -107,9 +107,9 @@ class MongoDbSessionHandler extends AbstractSessionHandler
|
||||
*/
|
||||
public function gc($maxlifetime)
|
||||
{
|
||||
$this->getCollection()->deleteMany(array(
|
||||
$this->options['expiry_field'] => array('$lt' => new \MongoDB\BSON\UTCDateTime()),
|
||||
));
|
||||
$this->getCollection()->deleteMany([
|
||||
$this->options['expiry_field'] => ['$lt' => new \MongoDB\BSON\UTCDateTime()],
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -121,16 +121,16 @@ class MongoDbSessionHandler extends AbstractSessionHandler
|
||||
{
|
||||
$expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
|
||||
|
||||
$fields = array(
|
||||
$fields = [
|
||||
$this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(),
|
||||
$this->options['expiry_field'] => $expiry,
|
||||
$this->options['data_field'] => new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY),
|
||||
);
|
||||
];
|
||||
|
||||
$this->getCollection()->updateOne(
|
||||
array($this->options['id_field'] => $sessionId),
|
||||
array('$set' => $fields),
|
||||
array('upsert' => true)
|
||||
[$this->options['id_field'] => $sessionId],
|
||||
['$set' => $fields],
|
||||
['upsert' => true]
|
||||
);
|
||||
|
||||
return true;
|
||||
@@ -144,11 +144,11 @@ class MongoDbSessionHandler extends AbstractSessionHandler
|
||||
$expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
|
||||
|
||||
$this->getCollection()->updateOne(
|
||||
array($this->options['id_field'] => $sessionId),
|
||||
array('$set' => array(
|
||||
[$this->options['id_field'] => $sessionId],
|
||||
['$set' => [
|
||||
$this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(),
|
||||
$this->options['expiry_field'] => $expiry,
|
||||
))
|
||||
]]
|
||||
);
|
||||
|
||||
return true;
|
||||
@@ -159,10 +159,10 @@ class MongoDbSessionHandler extends AbstractSessionHandler
|
||||
*/
|
||||
protected function doRead($sessionId)
|
||||
{
|
||||
$dbData = $this->getCollection()->findOne(array(
|
||||
$dbData = $this->getCollection()->findOne([
|
||||
$this->options['id_field'] => $sessionId,
|
||||
$this->options['expiry_field'] => array('$gte' => new \MongoDB\BSON\UTCDateTime()),
|
||||
));
|
||||
$this->options['expiry_field'] => ['$gte' => new \MongoDB\BSON\UTCDateTime()],
|
||||
]);
|
||||
|
||||
if (null === $dbData) {
|
||||
return '';
|
||||
|
||||
@@ -118,7 +118,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
/**
|
||||
* @var array Connection options when lazy-connect
|
||||
*/
|
||||
private $connectionOptions = array();
|
||||
private $connectionOptions = [];
|
||||
|
||||
/**
|
||||
* @var int The strategy for locking, see constants
|
||||
@@ -130,7 +130,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
*
|
||||
* @var \PDOStatement[] An array of statements to release advisory locks
|
||||
*/
|
||||
private $unlockStatements = array();
|
||||
private $unlockStatements = [];
|
||||
|
||||
/**
|
||||
* @var bool True when the current session exists but expired according to session.gc_maxlifetime
|
||||
@@ -161,7 +161,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
* * db_time_col: The column where to store the timestamp [default: sess_time]
|
||||
* * db_username: The username when lazy-connect [default: '']
|
||||
* * db_password: The password when lazy-connect [default: '']
|
||||
* * db_connection_options: An array of driver-specific connection options [default: array()]
|
||||
* * db_connection_options: An array of driver-specific connection options [default: []]
|
||||
* * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL]
|
||||
*
|
||||
* @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null
|
||||
@@ -169,7 +169,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
*
|
||||
* @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
|
||||
*/
|
||||
public function __construct($pdoOrDsn = null, array $options = array())
|
||||
public function __construct($pdoOrDsn = null, array $options = [])
|
||||
{
|
||||
if ($pdoOrDsn instanceof \PDO) {
|
||||
if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
|
||||
@@ -468,13 +468,13 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler');
|
||||
}
|
||||
|
||||
$driverAliasMap = array(
|
||||
$driverAliasMap = [
|
||||
'mssql' => 'sqlsrv',
|
||||
'mysql2' => 'mysql', // Amazon RDS, for some weird reason
|
||||
'postgres' => 'pgsql',
|
||||
'postgresql' => 'pgsql',
|
||||
'sqlite3' => 'sqlite',
|
||||
);
|
||||
];
|
||||
|
||||
$driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme'];
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class RedisSessionHandler extends AbstractSessionHandler
|
||||
*
|
||||
* @throws \InvalidArgumentException When unsupported client or options are passed
|
||||
*/
|
||||
public function __construct($redis, array $options = array())
|
||||
public function __construct($redis, array $options = [])
|
||||
{
|
||||
if (
|
||||
!$redis instanceof \Redis &&
|
||||
@@ -52,7 +52,7 @@ class RedisSessionHandler extends AbstractSessionHandler
|
||||
throw new \InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($redis) ? \get_class($redis) : \gettype($redis)));
|
||||
}
|
||||
|
||||
if ($diff = array_diff(array_keys($options), array('prefix'))) {
|
||||
if ($diff = array_diff(array_keys($options), ['prefix'])) {
|
||||
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff)));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class MetadataBag implements SessionBagInterface
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0);
|
||||
protected $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0];
|
||||
|
||||
/**
|
||||
* Unix timestamp.
|
||||
|
||||
@@ -50,7 +50,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array();
|
||||
protected $data = [];
|
||||
|
||||
/**
|
||||
* @var MetadataBag
|
||||
@@ -60,7 +60,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
/**
|
||||
* @var array|SessionBagInterface[]
|
||||
*/
|
||||
protected $bags = array();
|
||||
protected $bags = [];
|
||||
|
||||
public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
|
||||
{
|
||||
@@ -166,7 +166,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
}
|
||||
|
||||
// clear out the session
|
||||
$this->data = array();
|
||||
$this->data = [];
|
||||
|
||||
// reconnect the bags to the session
|
||||
$this->loadSession();
|
||||
@@ -238,11 +238,11 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
|
||||
protected function loadSession()
|
||||
{
|
||||
$bags = array_merge($this->bags, array($this->metadataBag));
|
||||
$bags = array_merge($this->bags, [$this->metadataBag]);
|
||||
|
||||
foreach ($bags as $bag) {
|
||||
$key = $bag->getStorageKey();
|
||||
$this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : array();
|
||||
$this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : [];
|
||||
$bag->initialize($this->data[$key]);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
|
||||
unset($data[$key]);
|
||||
}
|
||||
}
|
||||
if (array($key = $this->metadataBag->getStorageKey()) === array_keys($data)) {
|
||||
if ([$key = $this->metadataBag->getStorageKey()] === array_keys($data)) {
|
||||
unset($data[$key]);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
|
||||
private function read()
|
||||
{
|
||||
$filePath = $this->getFilePath();
|
||||
$this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array();
|
||||
$this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : [];
|
||||
|
||||
$this->loadSession();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
/**
|
||||
* @var SessionBagInterface[]
|
||||
*/
|
||||
protected $bags = array();
|
||||
protected $bags = [];
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
@@ -101,15 +101,15 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* @param \SessionHandlerInterface|null $handler
|
||||
* @param MetadataBag $metaBag MetadataBag
|
||||
*/
|
||||
public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null)
|
||||
public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null)
|
||||
{
|
||||
$options += array(
|
||||
$options += [
|
||||
'cache_limiter' => '',
|
||||
'cache_expire' => 0,
|
||||
'use_cookies' => 1,
|
||||
'lazy_write' => 1,
|
||||
'use_strict_mode' => 1,
|
||||
);
|
||||
];
|
||||
|
||||
session_register_shutdown();
|
||||
|
||||
@@ -244,7 +244,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
unset($_SESSION[$key]);
|
||||
}
|
||||
}
|
||||
if (array($key = $this->metadataBag->getStorageKey()) === array_keys($_SESSION)) {
|
||||
if ([$key = $this->metadataBag->getStorageKey()] === array_keys($_SESSION)) {
|
||||
unset($_SESSION[$key]);
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
}
|
||||
|
||||
// clear out the session
|
||||
$_SESSION = array();
|
||||
$_SESSION = [];
|
||||
|
||||
// reconnect the bags to the session
|
||||
$this->loadSession();
|
||||
@@ -349,7 +349,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* For convenience we omit 'session.' from the beginning of the keys.
|
||||
* Explicitly ignores other ini keys.
|
||||
*
|
||||
* @param array $options Session ini directives array(key => value)
|
||||
* @param array $options Session ini directives [key => value]
|
||||
*
|
||||
* @see http://php.net/session.configuration
|
||||
*/
|
||||
@@ -359,7 +359,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$validOptions = array_flip(array(
|
||||
$validOptions = array_flip([
|
||||
'cache_expire', 'cache_limiter', 'cookie_domain', 'cookie_httponly',
|
||||
'cookie_lifetime', 'cookie_path', 'cookie_secure', 'cookie_samesite',
|
||||
'gc_divisor', 'gc_maxlifetime', 'gc_probability',
|
||||
@@ -369,7 +369,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
|
||||
'upload_progress.freq', 'upload_progress.min_freq', 'url_rewriter.tags',
|
||||
'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags',
|
||||
));
|
||||
]);
|
||||
|
||||
foreach ($options as $key => $value) {
|
||||
if (isset($validOptions[$key])) {
|
||||
@@ -445,11 +445,11 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
$session = &$_SESSION;
|
||||
}
|
||||
|
||||
$bags = array_merge($this->bags, array($this->metadataBag));
|
||||
$bags = array_merge($this->bags, [$this->metadataBag]);
|
||||
|
||||
foreach ($bags as $bag) {
|
||||
$key = $bag->getStorageKey();
|
||||
$session[$key] = isset($session[$key]) ? $session[$key] : array();
|
||||
$session[$key] = isset($session[$key]) ? $session[$key] : [];
|
||||
$bag->initialize($session[$key]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user