Upgrade to latest Symfony HttpFoundation tag. Closes #1865.
This commit is contained in:
@@ -31,7 +31,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $storageKey The key used to store flashes in the session.
|
||||
* @param string $storageKey The key used to store attributes in the session.
|
||||
*/
|
||||
public function __construct($storageKey = '_sf2_attributes')
|
||||
{
|
||||
|
||||
@@ -177,10 +177,17 @@ class FlashBag implements FlashBagInterface, \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Returns the number of flashes.
|
||||
*
|
||||
* This method does not work.
|
||||
*
|
||||
* @deprecated in 2.2, removed in 2.3
|
||||
* @see https://github.com/symfony/symfony/issues/6408
|
||||
*
|
||||
* @return int The number of flashes
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
trigger_error(sprintf('%s() is deprecated since 2.2 and will be removed in 2.3', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return count($this->flashes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,6 +259,8 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function getFlashes()
|
||||
{
|
||||
trigger_error('getFlashes() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED);
|
||||
|
||||
$all = $this->getBag($this->flashName)->all();
|
||||
|
||||
$return = array();
|
||||
@@ -282,6 +284,8 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function setFlashes($values)
|
||||
{
|
||||
trigger_error('setFlashes() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED);
|
||||
|
||||
foreach ($values as $name => $value) {
|
||||
$this->getBag($this->flashName)->set($name, $value);
|
||||
}
|
||||
@@ -297,6 +301,8 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function getFlash($name, $default = null)
|
||||
{
|
||||
trigger_error('getFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED);
|
||||
|
||||
$return = $this->getBag($this->flashName)->get($name);
|
||||
|
||||
return empty($return) ? $default : reset($return);
|
||||
@@ -310,6 +316,8 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function setFlash($name, $value)
|
||||
{
|
||||
trigger_error('setFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED);
|
||||
|
||||
$this->getBag($this->flashName)->set($name, $value);
|
||||
}
|
||||
|
||||
@@ -322,6 +330,8 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function hasFlash($name)
|
||||
{
|
||||
trigger_error('hasFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->getBag($this->flashName)->has($name);
|
||||
}
|
||||
|
||||
@@ -332,6 +342,8 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function removeFlash($name)
|
||||
{
|
||||
trigger_error('removeFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED);
|
||||
|
||||
$this->getBag($this->flashName)->get($name);
|
||||
}
|
||||
|
||||
@@ -342,6 +354,8 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function clearFlashes()
|
||||
{
|
||||
trigger_error('clearFlashes() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $this->getBag($this->flashName)->clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,13 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* List of available options:
|
||||
* * database: The name of the database [required]
|
||||
* * collection: The name of the collection [required]
|
||||
* * id_field: The field name for storing the session id [default: _id]
|
||||
* * data_field: The field name for storing the session data [default: data]
|
||||
* * time_field: The field name for storing the timestamp [default: time]
|
||||
*
|
||||
* @param \Mongo|\MongoClient $mongo A MongoClient or Mongo instance
|
||||
* @param array $options An associative array of field options
|
||||
*
|
||||
@@ -55,9 +62,9 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
|
||||
$this->mongo = $mongo;
|
||||
|
||||
$this->options = array_merge(array(
|
||||
'id_field' => 'sess_id',
|
||||
'data_field' => 'sess_data',
|
||||
'time_field' => 'sess_time',
|
||||
'id_field' => '_id',
|
||||
'data_field' => 'data',
|
||||
'time_field' => 'time',
|
||||
), $options);
|
||||
}
|
||||
|
||||
@@ -82,10 +89,9 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
|
||||
*/
|
||||
public function destroy($sessionId)
|
||||
{
|
||||
$this->getCollection()->remove(
|
||||
array($this->options['id_field'] => $sessionId),
|
||||
array('justOne' => true)
|
||||
);
|
||||
$this->getCollection()->remove(array(
|
||||
$this->options['id_field'] => $sessionId
|
||||
));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -95,11 +101,21 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
|
||||
*/
|
||||
public function gc($lifetime)
|
||||
{
|
||||
$time = new \MongoTimestamp(time() - $lifetime);
|
||||
/* Note: MongoDB 2.2+ supports TTL collections, which may be used in
|
||||
* place of this method by indexing the "time_field" field with an
|
||||
* "expireAfterSeconds" option. Regardless of whether TTL collections
|
||||
* are used, consider indexing this field to make the remove query more
|
||||
* efficient.
|
||||
*
|
||||
* See: http://docs.mongodb.org/manual/tutorial/expire-data/
|
||||
*/
|
||||
$time = new \MongoDate(time() - $lifetime);
|
||||
|
||||
$this->getCollection()->remove(array(
|
||||
$this->options['time_field'] => array('$lt' => $time),
|
||||
));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,16 +123,13 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
|
||||
*/
|
||||
public function write($sessionId, $data)
|
||||
{
|
||||
$data = array(
|
||||
$this->options['id_field'] => $sessionId,
|
||||
$this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY),
|
||||
$this->options['time_field'] => new \MongoTimestamp()
|
||||
);
|
||||
|
||||
$this->getCollection()->update(
|
||||
array($this->options['id_field'] => $sessionId),
|
||||
array('$set' => $data),
|
||||
array('upsert' => true)
|
||||
array('$set' => array(
|
||||
$this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY),
|
||||
$this->options['time_field'] => new \MongoDate(),
|
||||
)),
|
||||
array('upsert' => true, 'multiple' => false)
|
||||
);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -27,17 +27,17 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
/**
|
||||
* Array of SessionBagInterface
|
||||
*
|
||||
* @var array
|
||||
* @var SessionBagInterface[]
|
||||
*/
|
||||
protected $bags;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @var Boolean
|
||||
*/
|
||||
protected $started = false;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @var Boolean
|
||||
*/
|
||||
protected $closed = false;
|
||||
|
||||
@@ -332,9 +332,9 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* Registers save handler as a PHP session handler.
|
||||
*
|
||||
* To use internal PHP session save handlers, override this method using ini_set with
|
||||
* session.save_handlers and session.save_path e.g.
|
||||
* session.save_handler and session.save_path e.g.
|
||||
*
|
||||
* ini_set('session.save_handlers', 'files');
|
||||
* ini_set('session.save_handler', 'files');
|
||||
* ini_set('session.save_path', /tmp');
|
||||
*
|
||||
* @see http://php.net/session-set-save-handler
|
||||
|
||||
@@ -99,6 +99,8 @@ abstract class AbstractProxy
|
||||
* Sets the session ID.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
@@ -123,6 +125,8 @@ abstract class AbstractProxy
|
||||
* Sets the session name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user