summaryrefslogtreecommitdiff
path: root/vendor/symfony/http-foundation/Session
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2017-12-07 09:16:01 +0000
committerGreg Roach <fisharebest@gmail.com>2017-12-07 09:16:01 +0000
commit3e983931fdde6db78f1490364106d7d46e77dea7 (patch)
treead258a855a10b1096e7ff4fc4d5dc377b628b3ce /vendor/symfony/http-foundation/Session
parentea51178689e8fd2aabc1dc599813355ef8b10ceb (diff)
downloadwebtrees-3e983931fdde6db78f1490364106d7d46e77dea7.tar.gz
webtrees-3e983931fdde6db78f1490364106d7d46e77dea7.tar.bz2
webtrees-3e983931fdde6db78f1490364106d7d46e77dea7.zip
Update to PhpUnit 6, for PHP 7
Diffstat (limited to 'vendor/symfony/http-foundation/Session')
-rw-r--r--vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php9
-rw-r--r--vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php9
-rw-r--r--vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php18
-rw-r--r--vendor/symfony/http-foundation/Session/Flash/FlashBag.php16
-rw-r--r--vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php2
-rw-r--r--vendor/symfony/http-foundation/Session/Session.php41
-rw-r--r--vendor/symfony/http-foundation/Session/SessionBagInterface.php2
-rw-r--r--vendor/symfony/http-foundation/Session/SessionBagProxy.php79
-rw-r--r--vendor/symfony/http-foundation/Session/SessionInterface.php4
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php168
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php15
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php29
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php65
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php5
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php7
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php22
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php81
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php89
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php7
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/MetadataBag.php2
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php12
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php26
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php90
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php9
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php2
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php9
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php10
-rw-r--r--vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php8
28 files changed, 240 insertions, 596 deletions
diff --git a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php
index ea1fda290f..af292e37a4 100644
--- a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php
+++ b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php
@@ -17,11 +17,20 @@ namespace Symfony\Component\HttpFoundation\Session\Attribute;
class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Countable
{
private $name = 'attributes';
+
+ /**
+ * @var string
+ */
private $storageKey;
+ /**
+ * @var array
+ */
protected $attributes = array();
/**
+ * Constructor.
+ *
* @param string $storageKey The key used to store attributes in the session
*/
public function __construct($storageKey = '_sf2_attributes')
diff --git a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
index abbf37ee7c..d797a6f238 100644
--- a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
+++ b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
@@ -19,9 +19,16 @@ namespace Symfony\Component\HttpFoundation\Session\Attribute;
*/
class NamespacedAttributeBag extends AttributeBag
{
+ /**
+ * Namespace character.
+ *
+ * @var string
+ */
private $namespaceCharacter;
/**
+ * Constructor.
+ *
* @param string $storageKey Session storage key
* @param string $namespaceCharacter Namespace character to use in keys
*/
@@ -102,7 +109,7 @@ class NamespacedAttributeBag extends AttributeBag
protected function &resolveAttributePath($name, $writeContext = false)
{
$array = &$this->attributes;
- $name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name;
+ $name = (strpos($name, $this->namespaceCharacter) === 0) ? substr($name, 1) : $name;
// Check if there is anything to do, else return
if (!$name) {
diff --git a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php
index 77521c2478..ddd603fdd1 100644
--- a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php
+++ b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php
@@ -19,13 +19,27 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
class AutoExpireFlashBag implements FlashBagInterface
{
private $name = 'flashes';
+
+ /**
+ * Flash messages.
+ *
+ * @var array
+ */
private $flashes = array('display' => array(), 'new' => array());
+
+ /**
+ * The storage key for flashes in the session.
+ *
+ * @var string
+ */
private $storageKey;
/**
+ * Constructor.
+ *
* @param string $storageKey The key used to store flashes in the session
*/
- public function __construct($storageKey = '_symfony_flashes')
+ public function __construct($storageKey = '_sf2_flashes')
{
$this->storageKey = $storageKey;
}
@@ -106,7 +120,7 @@ class AutoExpireFlashBag implements FlashBagInterface
public function all()
{
$return = $this->flashes['display'];
- $this->flashes['display'] = array();
+ $this->flashes = array('new' => array(), 'display' => array());
return $return;
}
diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php
index 12fb740c52..85b4f00b00 100644
--- a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php
+++ b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php
@@ -19,13 +19,27 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
class FlashBag implements FlashBagInterface
{
private $name = 'flashes';
+
+ /**
+ * Flash messages.
+ *
+ * @var array
+ */
private $flashes = array();
+
+ /**
+ * The storage key for flashes in the session.
+ *
+ * @var string
+ */
private $storageKey;
/**
+ * Constructor.
+ *
* @param string $storageKey The key used to store flashes in the session
*/
- public function __construct($storageKey = '_symfony_flashes')
+ public function __construct($storageKey = '_sf2_flashes')
{
$this->storageKey = $storageKey;
}
diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
index 80e97f17cd..25f3d57b54 100644
--- a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
+++ b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
@@ -72,6 +72,8 @@ interface FlashBagInterface extends SessionBagInterface
/**
* Sets all flash messages.
+ *
+ * @param array $messages
*/
public function setAll(array $messages);
diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php
index 0c3371fab6..70bcf3e090 100644
--- a/vendor/symfony/http-foundation/Session/Session.php
+++ b/vendor/symfony/http-foundation/Session/Session.php
@@ -19,18 +19,33 @@ use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
/**
+ * Session.
+ *
* @author Fabien Potencier <fabien@symfony.com>
* @author Drak <drak@zikula.org>
*/
class Session implements SessionInterface, \IteratorAggregate, \Countable
{
+ /**
+ * Storage driver.
+ *
+ * @var SessionStorageInterface
+ */
protected $storage;
+ /**
+ * @var string
+ */
private $flashName;
+
+ /**
+ * @var string
+ */
private $attributeName;
- private $data = array();
/**
+ * Constructor.
+ *
* @param SessionStorageInterface $storage A SessionStorageInterface instance
* @param AttributeBagInterface $attributes An AttributeBagInterface instance, (defaults null for default AttributeBag)
* @param FlashBagInterface $flashes A FlashBagInterface instance (defaults null for default FlashBag)
@@ -109,7 +124,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/
public function clear()
{
- $this->getAttributeBag()->clear();
+ $this->storage->getBag($this->attributeName)->clear();
}
/**
@@ -141,22 +156,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
}
/**
- * @return bool
- *
- * @internal
- */
- public function isEmpty()
- {
- foreach ($this->data as &$data) {
- if (!empty($data)) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
* {@inheritdoc}
*/
public function invalidate($lifetime = null)
@@ -227,7 +226,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/
public function registerBag(SessionBagInterface $bag)
{
- $this->storage->registerBag(new SessionBagProxy($bag, $this->data));
+ $this->storage->registerBag($bag);
}
/**
@@ -235,7 +234,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/
public function getBag($name)
{
- return $this->storage->getBag($name)->getBag();
+ return $this->storage->getBag($name);
}
/**
@@ -257,6 +256,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/
private function getAttributeBag()
{
- return $this->storage->getBag($this->attributeName)->getBag();
+ return $this->storage->getBag($this->attributeName);
}
}
diff --git a/vendor/symfony/http-foundation/Session/SessionBagInterface.php b/vendor/symfony/http-foundation/Session/SessionBagInterface.php
index 8e37d06d65..aca18aacbf 100644
--- a/vendor/symfony/http-foundation/Session/SessionBagInterface.php
+++ b/vendor/symfony/http-foundation/Session/SessionBagInterface.php
@@ -27,6 +27,8 @@ interface SessionBagInterface
/**
* Initializes the Bag.
+ *
+ * @param array $array
*/
public function initialize(array &$array);
diff --git a/vendor/symfony/http-foundation/Session/SessionBagProxy.php b/vendor/symfony/http-foundation/Session/SessionBagProxy.php
deleted file mode 100644
index 6c4cab6716..0000000000
--- a/vendor/symfony/http-foundation/Session/SessionBagProxy.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Session;
-
-/**
- * @author Nicolas Grekas <p@tchwork.com>
- *
- * @internal
- */
-final class SessionBagProxy implements SessionBagInterface
-{
- private $bag;
- private $data;
-
- public function __construct(SessionBagInterface $bag, array &$data)
- {
- $this->bag = $bag;
- $this->data = &$data;
- }
-
- /**
- * @return SessionBagInterface
- */
- public function getBag()
- {
- return $this->bag;
- }
-
- /**
- * @return bool
- */
- public function isEmpty()
- {
- return empty($this->data[$this->bag->getStorageKey()]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->bag->getName();
- }
-
- /**
- * {@inheritdoc}
- */
- public function initialize(array &$array)
- {
- $this->data[$this->bag->getStorageKey()] = &$array;
-
- $this->bag->initialize($array);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getStorageKey()
- {
- return $this->bag->getStorageKey();
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- return $this->bag->clear();
- }
-}
diff --git a/vendor/symfony/http-foundation/Session/SessionInterface.php b/vendor/symfony/http-foundation/Session/SessionInterface.php
index 95fca857e2..d3fcd2eec4 100644
--- a/vendor/symfony/http-foundation/Session/SessionInterface.php
+++ b/vendor/symfony/http-foundation/Session/SessionInterface.php
@@ -25,7 +25,7 @@ interface SessionInterface
*
* @return bool True if session started
*
- * @throws \RuntimeException if session fails to start
+ * @throws \RuntimeException If session fails to start.
*/
public function start();
@@ -159,6 +159,8 @@ interface SessionInterface
/**
* Registers a SessionBagInterface with the session.
+ *
+ * @param SessionBagInterface $bag
*/
public function registerBag(SessionBagInterface $bag);
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php
deleted file mode 100644
index 7c6c476aac..0000000000
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
-
-/**
- * This abstract session handler provides a generic implementation
- * of the PHP 7.0 SessionUpdateTimestampHandlerInterface,
- * enabling strict and lazy session handling.
- *
- * @author Nicolas Grekas <p@tchwork.com>
- */
-abstract class AbstractSessionHandler implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface
-{
- private $sessionName;
- private $prefetchId;
- private $prefetchData;
- private $newSessionId;
- private $igbinaryEmptyData;
-
- /**
- * {@inheritdoc}
- */
- public function open($savePath, $sessionName)
- {
- $this->sessionName = $sessionName;
- if (!headers_sent() && !ini_get('session.cache_limiter') && '0' !== ini_get('session.cache_limiter')) {
- header(sprintf('Cache-Control: max-age=%d, private, must-revalidate', 60 * (int) ini_get('session.cache_expire')));
- }
-
- return true;
- }
-
- /**
- * @param string $sessionId
- *
- * @return string
- */
- abstract protected function doRead($sessionId);
-
- /**
- * @param string $sessionId
- * @param string $data
- *
- * @return bool
- */
- abstract protected function doWrite($sessionId, $data);
-
- /**
- * @param string $sessionId
- *
- * @return bool
- */
- abstract protected function doDestroy($sessionId);
-
- /**
- * {@inheritdoc}
- */
- public function validateId($sessionId)
- {
- $this->prefetchData = $this->read($sessionId);
- $this->prefetchId = $sessionId;
-
- return '' !== $this->prefetchData;
- }
-
- /**
- * {@inheritdoc}
- */
- public function read($sessionId)
- {
- if (null !== $this->prefetchId) {
- $prefetchId = $this->prefetchId;
- $prefetchData = $this->prefetchData;
- $this->prefetchId = $this->prefetchData = null;
-
- if ($prefetchId === $sessionId || '' === $prefetchData) {
- $this->newSessionId = '' === $prefetchData ? $sessionId : null;
-
- return $prefetchData;
- }
- }
-
- $data = $this->doRead($sessionId);
- $this->newSessionId = '' === $data ? $sessionId : null;
- if (\PHP_VERSION_ID < 70000) {
- $this->prefetchData = $data;
- }
-
- return $data;
- }
-
- /**
- * {@inheritdoc}
- */
- public function write($sessionId, $data)
- {
- if (\PHP_VERSION_ID < 70000 && $this->prefetchData) {
- $readData = $this->prefetchData;
- $this->prefetchData = null;
-
- if ($readData === $data) {
- return $this->updateTimestamp($sessionId, $data);
- }
- }
- if (null === $this->igbinaryEmptyData) {
- // see https://github.com/igbinary/igbinary/issues/146
- $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : '';
- }
- if ('' === $data || $this->igbinaryEmptyData === $data) {
- return $this->destroy($sessionId);
- }
- $this->newSessionId = null;
-
- return $this->doWrite($sessionId, $data);
- }
-
- /**
- * {@inheritdoc}
- */
- public function destroy($sessionId)
- {
- if (\PHP_VERSION_ID < 70000) {
- $this->prefetchData = null;
- }
- if (!headers_sent() && ini_get('session.use_cookies')) {
- if (!$this->sessionName) {
- throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', get_class($this)));
- }
- $sessionCookie = sprintf(' %s=', urlencode($this->sessionName));
- $sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId));
- $sessionCookieFound = false;
- $otherCookies = array();
- foreach (headers_list() as $h) {
- if (0 !== stripos($h, 'Set-Cookie:')) {
- continue;
- }
- if (11 === strpos($h, $sessionCookie, 11)) {
- $sessionCookieFound = true;
-
- if (11 !== strpos($h, $sessionCookieWithId, 11)) {
- $otherCookies[] = $h;
- }
- } else {
- $otherCookies[] = $h;
- }
- }
- if ($sessionCookieFound) {
- header_remove('Set-Cookie');
- foreach ($otherCookies as $h) {
- header('Set-Cookie:'.$h, false);
- }
- } else {
- setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly'));
- }
- }
-
- return $this->newSessionId === $sessionId || $this->doDestroy($sessionId);
- }
-}
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php
index 84f4357b12..962a3878d9 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php
@@ -11,15 +11,16 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
-@trigger_error(sprintf('The class %s is deprecated since version 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead.', MemcacheSessionHandler::class), E_USER_DEPRECATED);
-
/**
- * @author Drak <drak@zikula.org>
+ * MemcacheSessionHandler.
*
- * @deprecated since version 3.4, to be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead.
+ * @author Drak <drak@zikula.org>
*/
class MemcacheSessionHandler implements \SessionHandlerInterface
{
+ /**
+ * @var \Memcache Memcache driver
+ */
private $memcache;
/**
@@ -33,6 +34,8 @@ class MemcacheSessionHandler implements \SessionHandlerInterface
private $prefix;
/**
+ * Constructor.
+ *
* List of available options:
* * prefix: The prefix to use for the memcache keys in order to avoid collision
* * expiretime: The time to live in seconds
@@ -92,9 +95,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface
*/
public function destroy($sessionId)
{
- $this->memcache->delete($this->prefix.$sessionId);
-
- return true;
+ return $this->memcache->delete($this->prefix.$sessionId);
}
/**
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
index 2d600b66cd..76b08e2db9 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
@@ -12,6 +12,8 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
/**
+ * MemcachedSessionHandler.
+ *
* Memcached based session storage handler based on the Memcached class
* provided by the PHP memcached extension.
*
@@ -19,8 +21,11 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
*
* @author Drak <drak@zikula.org>
*/
-class MemcachedSessionHandler extends AbstractSessionHandler
+class MemcachedSessionHandler implements \SessionHandlerInterface
{
+ /**
+ * @var \Memcached Memcached driver
+ */
private $memcached;
/**
@@ -34,9 +39,11 @@ class MemcachedSessionHandler extends AbstractSessionHandler
private $prefix;
/**
+ * Constructor.
+ *
* List of available options:
* * prefix: The prefix to use for the memcached keys in order to avoid collision
- * * expiretime: The time to live in seconds.
+ * * expiretime: The time to live in seconds
*
* @param \Memcached $memcached A \Memcached instance
* @param array $options An associative array of Memcached options
@@ -60,7 +67,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- public function close()
+ public function open($savePath, $sessionName)
{
return true;
}
@@ -68,23 +75,23 @@ class MemcachedSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- protected function doRead($sessionId)
+ public function close()
{
- return $this->memcached->get($this->prefix.$sessionId) ?: '';
+ return true;
}
/**
* {@inheritdoc}
*/
- public function updateTimestamp($sessionId, $data)
+ public function read($sessionId)
{
- return $this->memcached->touch($this->prefix.$sessionId, time() + $this->ttl);
+ return $this->memcached->get($this->prefix.$sessionId) ?: '';
}
/**
* {@inheritdoc}
*/
- protected function doWrite($sessionId, $data)
+ public function write($sessionId, $data)
{
return $this->memcached->set($this->prefix.$sessionId, $data, time() + $this->ttl);
}
@@ -92,11 +99,9 @@ class MemcachedSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- protected function doDestroy($sessionId)
+ public function destroy($sessionId)
{
- $result = $this->memcached->delete($this->prefix.$sessionId);
-
- return $result || \Memcached::RES_NOTFOUND == $this->memcached->getResultCode();
+ return $this->memcached->delete($this->prefix.$sessionId);
}
/**
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
index 264144d5b5..8408f000cd 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
@@ -12,15 +12,15 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
/**
- * Session handler using the mongodb/mongodb package and MongoDB driver extension.
+ * MongoDB session handler.
*
* @author Markus Bachmann <markus.bachmann@bachi.biz>
- *
- * @see https://packagist.org/packages/mongodb/mongodb
- * @see http://php.net/manual/en/set.mongodb.php
*/
-class MongoDbSessionHandler extends AbstractSessionHandler
+class MongoDbSessionHandler implements \SessionHandlerInterface
{
+ /**
+ * @var \Mongo|\MongoClient|\MongoDB\Client
+ */
private $mongo;
/**
@@ -34,13 +34,15 @@ class MongoDbSessionHandler extends AbstractSessionHandler
private $options;
/**
+ * 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]
- * * expiry_field: The field name for storing the expiry-timestamp [default: expires_at].
+ * * expiry_field: The field name for storing the expiry-timestamp [default: expires_at]
*
* It is strongly recommended to put an index on the `expiry_field` for
* garbage-collection. Alternatively it's possible to automatically expire
@@ -59,18 +61,14 @@ class MongoDbSessionHandler extends AbstractSessionHandler
* If you use such an index, you can drop `gc_probability` to 0 since
* no garbage-collection is required.
*
- * @param \MongoDB\Client $mongo A MongoDB\Client instance
- * @param array $options An associative array of field options
+ * @param \Mongo|\MongoClient|\MongoDB\Client $mongo A MongoDB\Client, MongoClient or Mongo instance
+ * @param array $options An associative array of field options
*
* @throws \InvalidArgumentException When MongoClient or Mongo instance not provided
* @throws \InvalidArgumentException When "database" or "collection" not provided
*/
public function __construct($mongo, array $options)
{
- if ($mongo instanceof \MongoClient || $mongo instanceof \Mongo) {
- @trigger_error(sprintf('Using %s with the legacy mongo extension is deprecated as of 3.4 and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.', __CLASS__), E_USER_DEPRECATED);
- }
-
if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
throw new \InvalidArgumentException('MongoClient or Mongo instance required');
}
@@ -92,6 +90,14 @@ class MongoDbSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
+ public function open($savePath, $sessionName)
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function close()
{
return true;
@@ -100,7 +106,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- protected function doDestroy($sessionId)
+ public function destroy($sessionId)
{
$methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove';
@@ -116,7 +122,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler
*/
public function gc($maxlifetime)
{
- $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteMany' : 'remove';
+ $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove';
$this->getCollection()->$methodName(array(
$this->options['expiry_field'] => array('$lt' => $this->createDateTime()),
@@ -128,7 +134,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- protected function doWrite($sessionId, $data)
+ public function write($sessionId, $data)
{
$expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime'));
@@ -160,34 +166,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- public function updateTimestamp($sessionId, $data)
- {
- $expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime'));
-
- if ($this->mongo instanceof \MongoDB\Client) {
- $methodName = 'updateOne';
- $options = array();
- } else {
- $methodName = 'update';
- $options = array('multiple' => false);
- }
-
- $this->getCollection()->$methodName(
- array($this->options['id_field'] => $sessionId),
- array('$set' => array(
- $this->options['time_field'] => $this->createDateTime(),
- $this->options['expiry_field'] => $expiry,
- )),
- $options
- );
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doRead($sessionId)
+ public function read($sessionId)
{
$dbData = $this->getCollection()->findOne(array(
$this->options['id_field'] => $sessionId,
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php
index 4e9704bd58..1be0a39837 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php
@@ -12,6 +12,8 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
/**
+ * NativeFileSessionHandler.
+ *
* Native session handler using PHP's built in file storage.
*
* @author Drak <drak@zikula.org>
@@ -19,6 +21,8 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
class NativeFileSessionHandler extends NativeSessionHandler
{
/**
+ * Constructor.
+ *
* @param string $savePath Path of directory to save session files
* Default null will leave setting as defined by PHP.
* '/path', 'N;/path', or 'N;octal-mode;/path
@@ -26,7 +30,6 @@ class NativeFileSessionHandler extends NativeSessionHandler
* @see http://php.net/session.configuration.php#ini.session.save-path for further details.
*
* @throws \InvalidArgumentException On invalid $savePath
- * @throws \RuntimeException When failing to create the save directory
*/
public function __construct($savePath = null)
{
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php
index 9ea4629ca1..4ae410f9b9 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php
@@ -12,13 +12,10 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
/**
- * @deprecated since version 3.4, to be removed in 4.0. Use \SessionHandler instead.
+ * Adds SessionHandler functionality if available.
+ *
* @see http://php.net/sessionhandler
*/
class NativeSessionHandler extends \SessionHandler
{
- public function __construct()
- {
- @trigger_error('The '.__NAMESPACE__.'\NativeSessionHandler class is deprecated since version 3.4 and will be removed in 4.0. Use the \SessionHandler class instead.', E_USER_DEPRECATED);
- }
}
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php
index 8d193155b0..1516d4314a 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php
@@ -12,16 +12,18 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
/**
+ * NullSessionHandler.
+ *
* Can be used in unit testing or in a situations where persisted sessions are not desired.
*
* @author Drak <drak@zikula.org>
*/
-class NullSessionHandler extends AbstractSessionHandler
+class NullSessionHandler implements \SessionHandlerInterface
{
/**
* {@inheritdoc}
*/
- public function close()
+ public function open($savePath, $sessionName)
{
return true;
}
@@ -29,7 +31,7 @@ class NullSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- public function validateId($sessionId)
+ public function close()
{
return true;
}
@@ -37,7 +39,7 @@ class NullSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- protected function doRead($sessionId)
+ public function read($sessionId)
{
return '';
}
@@ -45,15 +47,7 @@ class NullSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- public function updateTimestamp($sessionId, $data)
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doWrite($sessionId, $data)
+ public function write($sessionId, $data)
{
return true;
}
@@ -61,7 +55,7 @@ class NullSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- protected function doDestroy($sessionId)
+ public function destroy($sessionId)
{
return true;
}
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
index bccfbf611f..8909a5f401 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
@@ -38,7 +38,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
* @author Michael Williams <michael.williams@funsational.com>
* @author Tobias Schultze <http://tobion.de>
*/
-class PdoSessionHandler extends AbstractSessionHandler
+class PdoSessionHandler implements \SessionHandlerInterface
{
/**
* No locking is done. This means sessions are prone to loss of data due to
@@ -148,6 +148,8 @@ class PdoSessionHandler extends AbstractSessionHandler
private $gcCalled = false;
/**
+ * Constructor.
+ *
* You can either pass an existing database connection as PDO instance or
* pass a DSN string that will be used to lazy-connect to the database
* when the session is actually used. Furthermore it's possible to pass null
@@ -260,13 +262,11 @@ class PdoSessionHandler extends AbstractSessionHandler
*/
public function open($savePath, $sessionName)
{
- $this->sessionExpired = false;
-
if (null === $this->pdo) {
$this->connect($this->dsn ?: $savePath);
}
- return parent::open($savePath, $sessionName);
+ return true;
}
/**
@@ -275,7 +275,7 @@ class PdoSessionHandler extends AbstractSessionHandler
public function read($sessionId)
{
try {
- return parent::read($sessionId);
+ return $this->doRead($sessionId);
} catch (\PDOException $e) {
$this->rollback();
@@ -298,7 +298,7 @@ class PdoSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- protected function doDestroy($sessionId)
+ public function destroy($sessionId)
{
// delete the record associated with this id
$sql = "DELETE FROM $this->table WHERE $this->idCol = :id";
@@ -319,7 +319,7 @@ class PdoSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- protected function doWrite($sessionId, $data)
+ public function write($sessionId, $data)
{
$maxlifetime = (int) ini_get('session.gc_maxlifetime');
@@ -377,30 +377,6 @@ class PdoSessionHandler extends AbstractSessionHandler
/**
* {@inheritdoc}
*/
- public function updateTimestamp($sessionId, $data)
- {
- $maxlifetime = (int) ini_get('session.gc_maxlifetime');
-
- try {
- $updateStmt = $this->pdo->prepare(
- "UPDATE $this->table SET $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id"
- );
- $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
- $updateStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT);
- $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT);
- $updateStmt->execute();
- } catch (\PDOException $e) {
- $this->rollback();
-
- throw $e;
- }
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
public function close()
{
$this->commit();
@@ -413,7 +389,7 @@ class PdoSessionHandler extends AbstractSessionHandler
$this->gcCalled = false;
// delete the session records that have expired
- $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
+ $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time";
$stmt = $this->pdo->prepare($sql);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
@@ -517,8 +493,10 @@ class PdoSessionHandler extends AbstractSessionHandler
*
* @return string The session data
*/
- protected function doRead($sessionId)
+ private function doRead($sessionId)
{
+ $this->sessionExpired = false;
+
if (self::LOCK_ADVISORY === $this->lockMode) {
$this->unlockStatements[] = $this->doAdvisoryLock($sessionId);
}
@@ -541,9 +519,7 @@ class PdoSessionHandler extends AbstractSessionHandler
return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0];
}
- if (!ini_get('session.use_strict_mode') && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) {
- // In strict mode, session fixation is not possible: new sessions always start with a unique
- // random id, so that concurrency is not possible and this code path can be skipped.
+ if (self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) {
// Exclusive-reading of non-existent rows does not block, so we need to do an insert to block
// until other connections to the session are committed.
try {
@@ -604,11 +580,11 @@ class PdoSessionHandler extends AbstractSessionHandler
return $releaseStmt;
case 'pgsql':
// Obtaining an exclusive session level advisory lock requires an integer key.
- // When session.sid_bits_per_character > 4, the session id can contain non-hex-characters.
- // So we cannot just use hexdec().
- if (4 === \PHP_INT_SIZE) {
- $sessionInt1 = $this->convertStringToInt($sessionId);
- $sessionInt2 = $this->convertStringToInt(substr($sessionId, 4, 4));
+ // So we convert the HEX representation of the session id to an integer.
+ // Since integers are signed, we have to skip one hex char to fit in the range.
+ if (4 === PHP_INT_SIZE) {
+ $sessionInt1 = hexdec(substr($sessionId, 0, 7));
+ $sessionInt2 = hexdec(substr($sessionId, 7, 7));
$stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key1, :key2)');
$stmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT);
@@ -619,7 +595,7 @@ class PdoSessionHandler extends AbstractSessionHandler
$releaseStmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT);
$releaseStmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT);
} else {
- $sessionBigInt = $this->convertStringToInt($sessionId);
+ $sessionBigInt = hexdec(substr($sessionId, 0, 15));
$stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key)');
$stmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT);
@@ -638,27 +614,6 @@ class PdoSessionHandler extends AbstractSessionHandler
}
/**
- * Encodes the first 4 (when PHP_INT_SIZE == 4) or 8 characters of the string as an integer.
- *
- * Keep in mind, PHP integers are signed.
- *
- * @param string $string
- *
- * @return int
- */
- private function convertStringToInt($string)
- {
- if (4 === \PHP_INT_SIZE) {
- return (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]);
- }
-
- $int1 = (ord($string[7]) << 24) + (ord($string[6]) << 16) + (ord($string[5]) << 8) + ord($string[4]);
- $int2 = (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]);
-
- return $int2 + ($int1 << 32);
- }
-
- /**
* Return a locking or nonlocking SQL query to read session information.
*
* @return string The SQL string
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php
deleted file mode 100644
index 1bad0641e8..0000000000
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
-
-/**
- * Adds basic `SessionUpdateTimestampHandlerInterface` behaviors to another `SessionHandlerInterface`.
- *
- * @author Nicolas Grekas <p@tchwork.com>
- */
-class StrictSessionHandler extends AbstractSessionHandler
-{
- private $handler;
-
- public function __construct(\SessionHandlerInterface $handler)
- {
- if ($handler instanceof \SessionUpdateTimestampHandlerInterface) {
- throw new \LogicException(sprintf('"%s" is already an instance of "SessionUpdateTimestampHandlerInterface", you cannot wrap it with "%s".', get_class($handler), self::class));
- }
-
- $this->handler = $handler;
- }
-
- /**
- * {@inheritdoc}
- */
- public function open($savePath, $sessionName)
- {
- parent::open($savePath, $sessionName);
-
- return $this->handler->open($savePath, $sessionName);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doRead($sessionId)
- {
- return $this->handler->read($sessionId);
- }
-
- /**
- * {@inheritdoc}
- */
- public function updateTimestamp($sessionId, $data)
- {
- return $this->write($sessionId, $data);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doWrite($sessionId, $data)
- {
- return $this->handler->write($sessionId, $data);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDestroy($sessionId)
- {
- return $this->handler->destroy($sessionId);
- }
-
- /**
- * {@inheritdoc}
- */
- public function close()
- {
- return $this->handler->close();
- }
-
- /**
- * {@inheritdoc}
- */
- public function gc($maxlifetime)
- {
- return $this->handler->gc($maxlifetime);
- }
-}
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php
index 2fc7e09195..d49c36cae5 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php
@@ -11,17 +11,16 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
-@trigger_error(sprintf('The %s class is deprecated since version 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', WriteCheckSessionHandler::class), E_USER_DEPRECATED);
-
/**
* Wraps another SessionHandlerInterface to only write the session when it has been modified.
*
* @author Adrien Brault <adrien.brault@gmail.com>
- *
- * @deprecated since version 3.4, to be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.
*/
class WriteCheckSessionHandler implements \SessionHandlerInterface
{
+ /**
+ * @var \SessionHandlerInterface
+ */
private $wrappedSessionHandler;
/**
diff --git a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php
index 6f59af4869..322dd560f8 100644
--- a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php
+++ b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php
@@ -54,6 +54,8 @@ class MetadataBag implements SessionBagInterface
private $updateThreshold;
/**
+ * Constructor.
+ *
* @param string $storageKey The key used to store bag in the session
* @param int $updateThreshold The time to wait between two UPDATED updates
*/
diff --git a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php
index 027f4efffc..348fd23018 100644
--- a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php
+++ b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php
@@ -63,6 +63,8 @@ class MockArraySessionStorage implements SessionStorageInterface
protected $bags = array();
/**
+ * Constructor.
+ *
* @param string $name Session name
* @param MetadataBag $metaBag MetadataBag instance
*/
@@ -72,6 +74,11 @@ class MockArraySessionStorage implements SessionStorageInterface
$this->setMetadataBag($metaBag);
}
+ /**
+ * Sets the session data.
+ *
+ * @param array $array
+ */
public function setSessionData(array $array)
{
$this->data = $array;
@@ -208,6 +215,11 @@ class MockArraySessionStorage implements SessionStorageInterface
return $this->started;
}
+ /**
+ * Sets the MetadataBag.
+ *
+ * @param MetadataBag $bag
+ */
public function setMetadataBag(MetadataBag $bag = null)
{
if (null === $bag) {
diff --git a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php
index 14f427007b..71f9e55512 100644
--- a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php
+++ b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php
@@ -24,9 +24,14 @@ namespace Symfony\Component\HttpFoundation\Session\Storage;
*/
class MockFileSessionStorage extends MockArraySessionStorage
{
+ /**
+ * @var string
+ */
private $savePath;
/**
+ * Constructor.
+ *
* @param string $savePath Path of directory to save session files
* @param string $name Session name
* @param MetadataBag $metaBag MetadataBag instance
@@ -91,26 +96,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
}
- $data = $this->data;
-
- foreach ($this->bags as $bag) {
- if (empty($data[$key = $bag->getStorageKey()])) {
- unset($data[$key]);
- }
- }
- if (array($key = $this->metadataBag->getStorageKey()) === array_keys($data)) {
- unset($data[$key]);
- }
-
- try {
- if ($data) {
- file_put_contents($this->getFilePath(), serialize($data));
- } else {
- $this->destroy();
- }
- } finally {
- $this->data = $data;
- }
+ file_put_contents($this->getFilePath(), serialize($this->data));
// this is needed for Silex, where the session object is re-used across requests
// in functional tests. In Symfony, the container is rebooted, so we don't have
diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
index 0dfad9acb3..97161b8d0f 100644
--- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
+++ b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
@@ -11,8 +11,9 @@
namespace Symfony\Component\HttpFoundation\Session\Storage;
+use Symfony\Component\Debug\Exception\ContextErrorException;
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler;
+use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
@@ -24,9 +25,11 @@ use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
class NativeSessionStorage implements SessionStorageInterface
{
/**
+ * Array of SessionBagInterface.
+ *
* @var SessionBagInterface[]
*/
- protected $bags = array();
+ protected $bags;
/**
* @var bool
@@ -39,7 +42,7 @@ class NativeSessionStorage implements SessionStorageInterface
protected $closed = false;
/**
- * @var AbstractProxy|\SessionHandlerInterface
+ * @var AbstractProxy
*/
protected $saveHandler;
@@ -49,6 +52,8 @@ class NativeSessionStorage implements SessionStorageInterface
protected $metadataBag;
/**
+ * Constructor.
+ *
* Depending on how you want the storage driver to behave you probably
* want to override this constructor entirely.
*
@@ -61,7 +66,6 @@ class NativeSessionStorage implements SessionStorageInterface
* PHP starts to execute user-land code. Setting during runtime has no effect).
*
* cache_limiter, "" (use "0" to prevent headers from being sent entirely).
- * cache_expire, "0"
* cookie_domain, ""
* cookie_httponly, ""
* cookie_lifetime, "0"
@@ -74,7 +78,6 @@ class NativeSessionStorage implements SessionStorageInterface
* gc_probability, "1"
* hash_bits_per_character, "4"
* hash_function, "0"
- * lazy_write, "1"
* name, "PHPSESSID"
* referer_check, ""
* serialize_handler, "php"
@@ -94,18 +97,14 @@ class NativeSessionStorage implements SessionStorageInterface
* trans_sid_hosts, $_SERVER['HTTP_HOST']
* trans_sid_tags, "a=href,area=href,frame=src,form="
*
- * @param array $options Session configuration options
- * @param \SessionHandlerInterface|null $handler
- * @param MetadataBag $metaBag MetadataBag
+ * @param array $options Session configuration options
+ * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler
+ * @param MetadataBag $metaBag MetadataBag
*/
public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null)
{
- $options += array(
- 'cache_limiter' => '',
- 'cache_expire' => 0,
- 'use_cookies' => 1,
- 'lazy_write' => 1,
- );
+ session_cache_limiter(''); // disable by default because it's managed by HeaderBag (if used)
+ ini_set('session.use_cookies', 1);
session_register_shutdown();
@@ -117,7 +116,7 @@ class NativeSessionStorage implements SessionStorageInterface
/**
* Gets the save handler instance.
*
- * @return AbstractProxy|\SessionHandlerInterface
+ * @return AbstractProxy
*/
public function getSaveHandler()
{
@@ -193,10 +192,6 @@ class NativeSessionStorage implements SessionStorageInterface
return false;
}
- if (headers_sent()) {
- return false;
- }
-
if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
@@ -219,31 +214,15 @@ class NativeSessionStorage implements SessionStorageInterface
*/
public function save()
{
- $session = $_SESSION;
-
- foreach ($this->bags as $bag) {
- if (empty($_SESSION[$key = $bag->getStorageKey()])) {
- unset($_SESSION[$key]);
- }
- }
- if (array($key = $this->metadataBag->getStorageKey()) === array_keys($_SESSION)) {
- unset($_SESSION[$key]);
- }
-
// Register custom error handler to catch a possible failure warning during session write
- set_error_handler(function ($errno, $errstr, $errfile, $errline) {
- throw new \ErrorException($errstr, $errno, E_WARNING, $errfile, $errline);
+ set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) {
+ throw new ContextErrorException($errstr, $errno, E_WARNING, $errfile, $errline, $errcontext);
}, E_WARNING);
try {
- $e = null;
session_write_close();
- } catch (\ErrorException $e) {
- } finally {
restore_error_handler();
- $_SESSION = $session;
- }
- if (null !== $e) {
+ } catch (ContextErrorException $e) {
// The default PHP error message is not very helpful, as it does not give any information on the current save handler.
// Therefore, we catch this error and trigger a warning with a better error message
$handler = $this->getSaveHandler();
@@ -251,6 +230,7 @@ class NativeSessionStorage implements SessionStorageInterface
$handler = $handler->getHandler();
}
+ restore_error_handler();
trigger_error(sprintf('session_write_close(): Failed to write session data with %s handler', get_class($handler)), E_USER_WARNING);
}
@@ -296,7 +276,7 @@ class NativeSessionStorage implements SessionStorageInterface
throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name));
}
- if (!$this->started && $this->saveHandler->isActive()) {
+ if ($this->saveHandler->isActive() && !$this->started) {
$this->loadSession();
} elseif (!$this->started) {
$this->start();
@@ -305,6 +285,11 @@ class NativeSessionStorage implements SessionStorageInterface
return $this->bags[$name];
}
+ /**
+ * Sets the MetadataBag.
+ *
+ * @param MetadataBag $metaBag
+ */
public function setMetadataBag(MetadataBag $metaBag = null)
{
if (null === $metaBag) {
@@ -344,16 +329,12 @@ class NativeSessionStorage implements SessionStorageInterface
*/
public function setOptions(array $options)
{
- if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
- return;
- }
-
$validOptions = array_flip(array(
- 'cache_limiter', 'cache_expire', 'cookie_domain', 'cookie_httponly',
+ 'cache_limiter', 'cookie_domain', 'cookie_httponly',
'cookie_lifetime', 'cookie_path', 'cookie_secure',
'entropy_file', 'entropy_length', 'gc_divisor',
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
- 'hash_function', 'lazy_write', 'name', 'referer_check',
+ 'hash_function', 'name', 'referer_check',
'serialize_handler', 'use_strict_mode', 'use_cookies',
'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled',
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
@@ -377,7 +358,7 @@ class NativeSessionStorage implements SessionStorageInterface
* ini_set('session.save_handler', 'files');
* ini_set('session.save_path', '/tmp');
*
- * or pass in a \SessionHandler instance which configures session.save_handler in the
+ * or pass in a NativeSessionHandler instance which configures session.save_handler in the
* constructor, for a template see NativeFileSessionHandler or use handlers in
* composer package drak/native-session
*
@@ -386,33 +367,28 @@ class NativeSessionStorage implements SessionStorageInterface
* @see http://php.net/sessionhandler
* @see http://github.com/drak/NativeSession
*
- * @param \SessionHandlerInterface|null $saveHandler
+ * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $saveHandler
*
* @throws \InvalidArgumentException
*/
public function setSaveHandler($saveHandler = null)
{
if (!$saveHandler instanceof AbstractProxy &&
+ !$saveHandler instanceof NativeSessionHandler &&
!$saveHandler instanceof \SessionHandlerInterface &&
null !== $saveHandler) {
- throw new \InvalidArgumentException('Must be instance of AbstractProxy; implement \SessionHandlerInterface; or be null.');
+ throw new \InvalidArgumentException('Must be instance of AbstractProxy or NativeSessionHandler; implement \SessionHandlerInterface; or be null.');
}
// Wrap $saveHandler in proxy and prevent double wrapping of proxy
if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
$saveHandler = new SessionHandlerProxy($saveHandler);
} elseif (!$saveHandler instanceof AbstractProxy) {
- $saveHandler = new SessionHandlerProxy(new StrictSessionHandler(new \SessionHandler()));
+ $saveHandler = new SessionHandlerProxy(new \SessionHandler());
}
$this->saveHandler = $saveHandler;
- if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
- return;
- }
-
- if ($this->saveHandler instanceof SessionHandlerProxy) {
- session_set_save_handler($this->saveHandler->getHandler(), false);
- } elseif ($this->saveHandler instanceof \SessionHandlerInterface) {
+ if ($this->saveHandler instanceof \SessionHandlerInterface) {
session_set_save_handler($this->saveHandler, false);
}
}
@@ -424,6 +400,8 @@ class NativeSessionStorage implements SessionStorageInterface
* are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()).
* PHP takes the return value from the read() handler, unserializes it
* and populates $_SESSION with the result automatically.
+ *
+ * @param array|null $session
*/
protected function loadSession(array &$session = null)
{
diff --git a/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php
index 662ed5015a..6f02a7fd73 100644
--- a/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php
+++ b/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php
@@ -11,6 +11,9 @@
namespace Symfony\Component\HttpFoundation\Session\Storage;
+use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
+use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
+
/**
* Allows session to be started by PHP and managed by Symfony.
*
@@ -19,8 +22,10 @@ namespace Symfony\Component\HttpFoundation\Session\Storage;
class PhpBridgeSessionStorage extends NativeSessionStorage
{
/**
- * @param \SessionHandlerInterface|null $handler
- * @param MetadataBag $metaBag MetadataBag
+ * Constructor.
+ *
+ * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler
+ * @param MetadataBag $metaBag MetadataBag
*/
public function __construct($handler = null, MetadataBag $metaBag = null)
{
diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php
index 09c92483c7..a7478656d6 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php
@@ -12,6 +12,8 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
/**
+ * AbstractProxy.
+ *
* @author Drak <drak@zikula.org>
*/
abstract class AbstractProxy
diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php
index 460abe15c3..0db34aa28d 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php
@@ -11,17 +11,18 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
-@trigger_error('The '.__NAMESPACE__.'\NativeProxy class is deprecated since version 3.4 and will be removed in 4.0. Use your session handler implementation directly.', E_USER_DEPRECATED);
-
/**
- * This proxy is built-in session handlers in PHP 5.3.x.
+ * NativeProxy.
*
- * @deprecated since version 3.4, to be removed in 4.0. Use your session handler implementation directly.
+ * This proxy is built-in session handlers in PHP 5.3.x
*
* @author Drak <drak@zikula.org>
*/
class NativeProxy extends AbstractProxy
{
+ /**
+ * Constructor.
+ */
public function __construct()
{
// this makes an educated guess as to what the handler is since it should already be set.
diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php
index 53c1209a1c..68ed713c22 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php
@@ -12,12 +12,22 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
/**
+ * SessionHandler proxy.
+ *
* @author Drak <drak@zikula.org>
*/
class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface
{
+ /**
+ * @var \SessionHandlerInterface
+ */
protected $handler;
+ /**
+ * Constructor.
+ *
+ * @param \SessionHandlerInterface $handler
+ */
public function __construct(\SessionHandlerInterface $handler)
{
$this->handler = $handler;
diff --git a/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php b/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php
index 66e8b33dd2..34f6c4633f 100644
--- a/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php
+++ b/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php
@@ -26,7 +26,7 @@ interface SessionStorageInterface
*
* @return bool True if started
*
- * @throws \RuntimeException if something goes wrong starting the session
+ * @throws \RuntimeException If something goes wrong starting the session.
*/
public function start();
@@ -104,8 +104,8 @@ interface SessionStorageInterface
* a real PHP session would interfere with testing, in which case
* it should actually persist the session data if required.
*
- * @throws \RuntimeException if the session is saved without being started, or if the session
- * is already closed
+ * @throws \RuntimeException If the session is saved without being started, or if the session
+ * is already closed.
*/
public function save();
@@ -127,6 +127,8 @@ interface SessionStorageInterface
/**
* Registers a SessionBagInterface for use.
+ *
+ * @param SessionBagInterface $bag
*/
public function registerBag(SessionBagInterface $bag);