From 73a1235c176ebb09e8f402343e90d5e6c9dff872 Mon Sep 17 00:00:00 2001 From: Alexandru Furculita Date: Sun, 17 Sep 2017 15:54:32 +0300 Subject: [PATCH 1/3] [HttpFoundation] Deprecate <5.4 session functionality Signed-off-by: Alexandru Furculita --- UPGRADE-3.4.md | 24 +++++++++++++++++++ UPGRADE-4.0.md | 9 +++++++ .../Component/HttpFoundation/CHANGELOG.md | 8 +++++++ .../Handler/MemcacheSessionHandler.php | 2 -- .../Handler/MemcachedSessionHandler.php | 2 -- .../Storage/Handler/MongoDbSessionHandler.php | 2 -- .../Handler/NativeFileSessionHandler.php | 5 +--- .../Storage/Handler/NativeSessionHandler.php | 5 ++-- .../Storage/Handler/NullSessionHandler.php | 2 -- .../Session/Storage/NativeSessionStorage.php | 18 +++++++------- .../Storage/PhpBridgeSessionStorage.php | 5 ++-- .../Session/Storage/Proxy/AbstractProxy.php | 12 +++++++++- .../Session/Storage/Proxy/NativeProxy.php | 6 +++-- .../Storage/Proxy/SessionHandlerProxy.php | 7 ------ .../Handler/NativeSessionHandlerTest.php | 1 + .../Storage/Proxy/AbstractProxyTest.php | 6 +++++ .../Session/Storage/Proxy/NativeProxyTest.php | 2 ++ 17 files changed, 80 insertions(+), 36 deletions(-) diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md index cdc062008bf4b..2cfc98b0361da 100644 --- a/UPGRADE-3.4.md +++ b/UPGRADE-3.4.md @@ -205,6 +205,30 @@ FrameworkBundle `TranslationDebugCommand`, `TranslationUpdateCommand`, `XliffLintCommand` and `YamlLintCommand` classes have been marked as final +HttpFoundation +-------------- + + * The `Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler` + class has been deprecated and will be removed in 4.0. Use the `\SessionHandler` class instead. + + * The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy` class has been + deprecated and will be removed in 4.0. Use the `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` + class instead. + + * The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` class has been + deprecated and will be removed in 4.0. Use the `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` + class instead. + + * The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy::isSessionHandlerInterface()` + method has been deprecated and will be removed in 4.0. + + * The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy::isWrapper()` + method has been deprecated and will be removed in 4.0. You can check explicitly if the proxy wraps + a `\SessionHandler` instance. + + * `NativeSessionStorage::setSaveHandler()` now takes an instance of `\SessionHandlerInterface` as argument. + Not passing it is deprecated and will throw a `TypeError` in 4.0. + HttpKernel ---------- diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 3aecb70070f0d..3bf532b0c96fc 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -524,6 +524,15 @@ HttpFoundation * The ability to check only for cacheable HTTP methods using `Request::isMethodSafe()` is not supported anymore, use `Request::isMethodCacheable()` instead. + * The `Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler`, + `Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy` and + `Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` classes have been removed. + + * The `SessionHandlerProxy::isSessionHandlerInterface()` and `SessionHandlerProxy::isWrapper()` + methods have been removed. + + * `NativeSessionStorage::setSaveHandler()` now requires an instance of `\SessionHandlerInterface` as argument. + HttpKernel ---------- diff --git a/src/Symfony/Component/HttpFoundation/CHANGELOG.md b/src/Symfony/Component/HttpFoundation/CHANGELOG.md index e1fdf77b9b8ae..ce07f8fd7ccb2 100644 --- a/src/Symfony/Component/HttpFoundation/CHANGELOG.md +++ b/src/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -1,6 +1,14 @@ CHANGELOG ========= +3.4.0 +----- + + * deprecated the `NativeSessionHandler` class, + * deprecated the `AbstractProxy` and `NativeProxy` classes in favor of `SessionHandlerProxy` class, + * deprecated the `SessionHandlerProxy::isSessionHandlerInterface()` and `SessionHandlerProxy::isWrapper()` methods, + * deprecated setting session save handlers that do not implement `\SessionHandlerInterface` in `NativeSessionStorage::setSaveHandler()` + 3.3.0 ----- diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php index 4e490a05d4ce0..26a0a17e98ff0 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * MemcacheSessionHandler. - * * @author Drak */ class MemcacheSessionHandler implements \SessionHandlerInterface diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index dfe2fee0d44be..5e9ba7103bdfe 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * MemcachedSessionHandler. - * * Memcached based session storage handler based on the Memcached class * provided by the PHP memcached extension. * diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 8408f000cdbf8..cfc427bceaed5 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * MongoDB session handler. - * * @author Markus Bachmann */ class MongoDbSessionHandler implements \SessionHandlerInterface diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php index 1be0a39837333..4e9704bd5858f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * NativeFileSessionHandler. - * * Native session handler using PHP's built in file storage. * * @author Drak @@ -21,8 +19,6 @@ 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 @@ -30,6 +26,7 @@ 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/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php index 4ae410f9b9e1f..daa7dbd15b7c8 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php @@ -11,9 +11,10 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; +@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); + /** - * Adds SessionHandler functionality if available. - * + * @deprecated since version 3.4, to be removed in 4.0. Use \SessionHandler instead. * @see http://php.net/sessionhandler */ class NativeSessionHandler extends \SessionHandler diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php index 1516d4314a430..981d96d93a978 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php @@ -12,8 +12,6 @@ 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 diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 97161b8d0f8a1..72c98891f5af8 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -13,7 +13,6 @@ use Symfony\Component\Debug\Exception\ContextErrorException; use Symfony\Component\HttpFoundation\Session\SessionBagInterface; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; @@ -97,9 +96,9 @@ 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 AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag + * @param array $options Session configuration options + * @param AbstractProxy|\SessionHandlerInterface|null $handler + * @param MetadataBag $metaBag MetadataBag */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) { @@ -276,7 +275,7 @@ public function getBag($name) throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); } - if ($this->saveHandler->isActive() && !$this->started) { + if (!$this->started && $this->saveHandler->isActive()) { $this->loadSession(); } elseif (!$this->started) { $this->start(); @@ -358,7 +357,7 @@ public function setOptions(array $options) * ini_set('session.save_handler', 'files'); * ini_set('session.save_path', '/tmp'); * - * or pass in a NativeSessionHandler instance which configures session.save_handler in the + * or pass in a \SessionHandler instance which configures session.save_handler in the * constructor, for a template see NativeFileSessionHandler or use handlers in * composer package drak/native-session * @@ -367,17 +366,16 @@ public function setOptions(array $options) * @see http://php.net/sessionhandler * @see http://github.com/drak/NativeSession * - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $saveHandler + * @param AbstractProxy|\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 or NativeSessionHandler; implement \SessionHandlerInterface; or be null.'); + throw new \InvalidArgumentException('Must be instance of AbstractProxy; implement \SessionHandlerInterface; or be null.'); } // Wrap $saveHandler in proxy and prevent double wrapping of proxy @@ -390,6 +388,8 @@ public function setSaveHandler($saveHandler = null) if ($this->saveHandler instanceof \SessionHandlerInterface) { session_set_save_handler($this->saveHandler, false); + } else { + @trigger_error('Using session save handlers that do not implement \SessionHandlerInterface is deprecated since version 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php index 6f02a7fd73d23..ced5782696335 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php @@ -12,7 +12,6 @@ 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. @@ -24,8 +23,8 @@ class PhpBridgeSessionStorage extends NativeSessionStorage /** * Constructor. * - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag + * @param AbstractProxy|\SessionHandlerInterface|null $handler + * @param MetadataBag $metaBag MetadataBag */ public function __construct($handler = null, MetadataBag $metaBag = null) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index a7478656d672d..3d8f34a3b7cbc 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -12,7 +12,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; /** - * AbstractProxy. + * @deprecated since version 3.4, to be removed in 4.0. Use SessionHandlerProxy instead. * * @author Drak */ @@ -21,6 +21,8 @@ abstract class AbstractProxy /** * Flag if handler wraps an internal PHP session handler (using \SessionHandler). * + * @deprecated since version 3.4 and will be removed in 4.0. + * * @var bool */ protected $wrapper = false; @@ -43,20 +45,28 @@ public function getSaveHandlerName() /** * Is this proxy handler and instance of \SessionHandlerInterface. * + * @deprecated since version 3.4 and will be removed in 4.0. + * * @return bool */ public function isSessionHandlerInterface() { + @trigger_error('isSessionHandlerInterface() is deprecated since version 3.4 and will be removed in 4.0. A session handler proxy should always implement \SessionHandlerInterface.', E_USER_DEPRECATED); + return $this instanceof \SessionHandlerInterface; } /** * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. * + * @deprecated since version 3.4 and will be removed in 4.0. + * * @return bool */ public function isWrapper() { + @trigger_error('isWrapper() is deprecated since version 3.4 and will be removed in 4.0. You should explicitly check if the handler proxy wraps a \SessionHandler instance.', E_USER_DEPRECATED); + return $this->wrapper; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php index 0db34aa28d385..bda431358310e 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php @@ -11,10 +11,12 @@ 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 the Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy class instead.', E_USER_DEPRECATED); + /** - * NativeProxy. + * This proxy is built-in session handlers in PHP 5.3.x. * - * This proxy is built-in session handlers in PHP 5.3.x + * @deprecated since version 3.4, to be removed in 4.0. Use SessionHandlerProxy instead. * * @author Drak */ diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php index 68ed713c22ffe..359bb877b5e30 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; /** - * SessionHandler proxy. - * * @author Drak */ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface @@ -23,11 +21,6 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf */ protected $handler; - /** - * Constructor. - * - * @param \SessionHandlerInterface $handler - */ public function __construct(\SessionHandlerInterface $handler) { $this->handler = $handler; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php index 5486b2d655ea8..fe4cc72d23b56 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php @@ -21,6 +21,7 @@ * * @runTestsInSeparateProcesses * @preserveGlobalState disabled + * @group legacy */ class NativeSessionHandlerTest extends TestCase { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php index ef1da130a2a1a..c35a2215304f4 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php @@ -74,6 +74,9 @@ public function testGetSaveHandlerName() $this->assertNull($this->proxy->getSaveHandlerName()); } + /** + * @group legacy + */ public function testIsSessionHandlerInterface() { $this->assertFalse($this->proxy->isSessionHandlerInterface()); @@ -81,6 +84,9 @@ public function testIsSessionHandlerInterface() $this->assertTrue($sh->isSessionHandlerInterface()); } + /** + * @group legacy + */ public function testIsWrapper() { $this->assertFalse($this->proxy->isWrapper()); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/NativeProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/NativeProxyTest.php index 8ec3053441366..ed4fee6bfec0f 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/NativeProxyTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/NativeProxyTest.php @@ -17,6 +17,8 @@ /** * Test class for NativeProxy. * + * @group legacy + * * @author Drak */ class NativeProxyTest extends TestCase From 831c006e4244e83d60f5b0f7600a15082580d302 Mon Sep 17 00:00:00 2001 From: Alexandru Furculita Date: Sun, 24 Sep 2017 22:31:02 +0300 Subject: [PATCH 2/3] Deprecate SessonHanderProxy Signed-off-by: Alexandru Furculita --- UPGRADE-3.4.md | 14 ++---- UPGRADE-4.0.md | 8 ++-- .../Bridge/Twig/Tests/AppVariableTest.php | 8 ++-- .../Tests/Controller/ControllerTraitTest.php | 2 +- .../Component/HttpFoundation/CHANGELOG.md | 3 +- .../Session/Storage/MetadataBag.php | 2 - .../Storage/MockArraySessionStorage.php | 2 - .../Storage/MockFileSessionStorage.php | 2 - .../Session/Storage/NativeSessionStorage.php | 13 +++--- .../Storage/PhpBridgeSessionStorage.php | 2 - .../Session/Storage/Proxy/AbstractProxy.php | 14 ++---- .../Session/Storage/Proxy/NativeProxy.php | 4 +- .../Storage/Proxy/SessionHandlerProxy.php | 4 ++ .../Storage/NativeSessionStorageTest.php | 12 ++--- .../Storage/Proxy/AbstractProxyTest.php | 46 ++----------------- .../Storage/Proxy/SessionHandlerProxyTest.php | 1 + 16 files changed, 42 insertions(+), 95 deletions(-) diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md index 2cfc98b0361da..04d107e512c59 100644 --- a/UPGRADE-3.4.md +++ b/UPGRADE-3.4.md @@ -212,19 +212,13 @@ HttpFoundation class has been deprecated and will be removed in 4.0. Use the `\SessionHandler` class instead. * The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy` class has been - deprecated and will be removed in 4.0. Use the `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` - class instead. + deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly. * The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` class has been - deprecated and will be removed in 4.0. Use the `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` - class instead. + deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly. - * The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy::isSessionHandlerInterface()` - method has been deprecated and will be removed in 4.0. - - * The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy::isWrapper()` - method has been deprecated and will be removed in 4.0. You can check explicitly if the proxy wraps - a `\SessionHandler` instance. + * The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` class has been + deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly. * `NativeSessionStorage::setSaveHandler()` now takes an instance of `\SessionHandlerInterface` as argument. Not passing it is deprecated and will throw a `TypeError` in 4.0. diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 3bf532b0c96fc..dc0bd0d82503d 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -525,11 +525,9 @@ HttpFoundation not supported anymore, use `Request::isMethodCacheable()` instead. * The `Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler`, - `Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy` and - `Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` classes have been removed. - - * The `SessionHandlerProxy::isSessionHandlerInterface()` and `SessionHandlerProxy::isWrapper()` - methods have been removed. + `Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy`, + `Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` and + `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` classes have been removed. * `NativeSessionStorage::setSaveHandler()` now requires an instance of `\SessionHandlerInterface` as argument. diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php index 2a97c269031c8..c258ad41a1465 100644 --- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php +++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php @@ -47,8 +47,9 @@ public function testEnvironment() public function testGetSession() { + $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - $request->method('getSession')->willReturn($session = new Session()); + $request->method('getSession')->willReturn($session); $this->setRequestStack($request); @@ -167,8 +168,9 @@ public function testGetFlashesWithNoRequest() public function testGetFlashesWithNoSessionStarted() { + $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - $request->method('getSession')->willReturn(new Session()); + $request->method('getSession')->willReturn($session); $this->setRequestStack($request); @@ -257,7 +259,7 @@ private function setFlashMessages() $flashBag = new FlashBag(); $flashBag->initialize($flashMessages); - $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->getMock(); + $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->disableOriginalConstructor()->getMock(); $session->method('isStarted')->willReturn(true); $session->method('getFlashBag')->willReturn($flashBag); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php index 3feabfd12e273..71e6f581e7389 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php @@ -376,7 +376,7 @@ public function testRedirectToRoute() public function testAddFlash() { $flashBag = new FlashBag(); - $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->getMock(); + $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->disableOriginalConstructor()->getMock(); $session->expects($this->once())->method('getFlashBag')->willReturn($flashBag); $container = new Container(); diff --git a/src/Symfony/Component/HttpFoundation/CHANGELOG.md b/src/Symfony/Component/HttpFoundation/CHANGELOG.md index ce07f8fd7ccb2..d60ebdfe8daaa 100644 --- a/src/Symfony/Component/HttpFoundation/CHANGELOG.md +++ b/src/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -5,8 +5,7 @@ CHANGELOG ----- * deprecated the `NativeSessionHandler` class, - * deprecated the `AbstractProxy` and `NativeProxy` classes in favor of `SessionHandlerProxy` class, - * deprecated the `SessionHandlerProxy::isSessionHandlerInterface()` and `SessionHandlerProxy::isWrapper()` methods, + * deprecated the `AbstractProxy`, `NativeProxy` and `SessionHandlerProxy` classes, * deprecated setting session save handlers that do not implement `\SessionHandlerInterface` in `NativeSessionStorage::setSaveHandler()` 3.3.0 diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php index 322dd560f8087..6f59af486981e 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php @@ -54,8 +54,6 @@ 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/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index 348fd23018a03..0349a43367d76 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -63,8 +63,6 @@ class MockArraySessionStorage implements SessionStorageInterface protected $bags = array(); /** - * Constructor. - * * @param string $name Session name * @param MetadataBag $metaBag MetadataBag instance */ diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php index 71f9e555121fa..8c1bf73caefb3 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php @@ -30,8 +30,6 @@ class MockFileSessionStorage extends MockArraySessionStorage private $savePath; /** - * Constructor. - * * @param string $savePath Path of directory to save session files * @param string $name Session name * @param MetadataBag $metaBag MetadataBag instance diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 72c98891f5af8..f4d73bfbde8ef 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -24,8 +24,6 @@ class NativeSessionStorage implements SessionStorageInterface { /** - * Array of SessionBagInterface. - * * @var SessionBagInterface[] */ protected $bags; @@ -51,8 +49,6 @@ 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. * @@ -378,6 +374,13 @@ public function setSaveHandler($saveHandler = null) throw new \InvalidArgumentException('Must be instance of AbstractProxy; implement \SessionHandlerInterface; or be null.'); } + if ($saveHandler instanceof AbstractProxy) { + @trigger_error( + 'Using session save handlers that are instances of AbstractProxy is deprecated since version 3.4 and will be removed in 4.0.', + E_USER_DEPRECATED + ); + } + // Wrap $saveHandler in proxy and prevent double wrapping of proxy if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) { $saveHandler = new SessionHandlerProxy($saveHandler); @@ -388,8 +391,6 @@ public function setSaveHandler($saveHandler = null) if ($this->saveHandler instanceof \SessionHandlerInterface) { session_set_save_handler($this->saveHandler, false); - } else { - @trigger_error('Using session save handlers that do not implement \SessionHandlerInterface is deprecated since version 3.4 and will be removed in 4.0.', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php index ced5782696335..abdc0064cfbfc 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php @@ -21,8 +21,6 @@ class PhpBridgeSessionStorage extends NativeSessionStorage { /** - * Constructor. - * * @param AbstractProxy|\SessionHandlerInterface|null $handler * @param MetadataBag $metaBag MetadataBag */ diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 3d8f34a3b7cbc..c1c8b9b1f7dd2 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -11,8 +11,10 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; +@trigger_error('The '.__NAMESPACE__.'\AbstractProxy class is deprecated since version 3.4 and will be removed in 4.0. Use your session handler implementation directly.', E_USER_DEPRECATED); + /** - * @deprecated since version 3.4, to be removed in 4.0. Use SessionHandlerProxy instead. + * @deprecated since version 3.4, to be removed in 4.0. Use your session handler implementation directly. * * @author Drak */ @@ -21,8 +23,6 @@ abstract class AbstractProxy /** * Flag if handler wraps an internal PHP session handler (using \SessionHandler). * - * @deprecated since version 3.4 and will be removed in 4.0. - * * @var bool */ protected $wrapper = false; @@ -45,28 +45,20 @@ public function getSaveHandlerName() /** * Is this proxy handler and instance of \SessionHandlerInterface. * - * @deprecated since version 3.4 and will be removed in 4.0. - * * @return bool */ public function isSessionHandlerInterface() { - @trigger_error('isSessionHandlerInterface() is deprecated since version 3.4 and will be removed in 4.0. A session handler proxy should always implement \SessionHandlerInterface.', E_USER_DEPRECATED); - return $this instanceof \SessionHandlerInterface; } /** * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. * - * @deprecated since version 3.4 and will be removed in 4.0. - * * @return bool */ public function isWrapper() { - @trigger_error('isWrapper() is deprecated since version 3.4 and will be removed in 4.0. You should explicitly check if the handler proxy wraps a \SessionHandler instance.', E_USER_DEPRECATED); - return $this->wrapper; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php index bda431358310e..e75497d57c3b3 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php @@ -11,12 +11,12 @@ 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 the Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy class instead.', E_USER_DEPRECATED); +@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. * - * @deprecated since version 3.4, to be removed in 4.0. Use SessionHandlerProxy instead. + * @deprecated since version 3.4, to be removed in 4.0. Use your session handler implementation directly. * * @author Drak */ diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php index 359bb877b5e30..d6adef82dbf65 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -11,7 +11,11 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; +@trigger_error('The '.__NAMESPACE__.'\SessionHandlerProxy class is deprecated since version 3.4 and will be removed in 4.0. Use your session handler implementation directly.', E_USER_DEPRECATED); + /** + * @deprecated since version 3.4, to be removed in 4.0. Use your session handler implementation directly. + * * @author Drak */ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 818c63a9d2ae2..a02aac8103755 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -198,17 +198,17 @@ public function testSetSaveHandler() $this->iniSet('session.save_handler', 'files'); $storage = $this->getStorage(); $storage->setSaveHandler(); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); + $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); $storage->setSaveHandler(null); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); + $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); $storage->setSaveHandler(new SessionHandlerProxy(new NativeSessionHandler())); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); + $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); $storage->setSaveHandler(new NativeSessionHandler()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); + $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); $storage->setSaveHandler(new SessionHandlerProxy(new NullSessionHandler())); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); + $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); $storage->setSaveHandler(new NullSessionHandler()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); + $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); } /** diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php index c35a2215304f4..f2be722c8f522 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php @@ -13,43 +13,13 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; - -// Note until PHPUnit_Mock_Objects 1.2 is released you cannot mock abstracts due to -// https://github.com/sebastianbergmann/phpunit-mock-objects/issues/73 -class ConcreteProxy extends AbstractProxy -{ -} - -class ConcreteSessionHandlerInterfaceProxy extends AbstractProxy implements \SessionHandlerInterface -{ - public function open($savePath, $sessionName) - { - } - - public function close() - { - } - - public function read($id) - { - } - - public function write($id, $data) - { - } - - public function destroy($id) - { - } - - public function gc($maxlifetime) - { - } -} +use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; /** * Test class for AbstractProxy. * + * @group legacy + * * @author Drak */ class AbstractProxyTest extends TestCase @@ -61,7 +31,7 @@ class AbstractProxyTest extends TestCase protected function setUp() { - $this->proxy = new ConcreteProxy(); + $this->proxy = $this->getMockForAbstractClass(AbstractProxy::class); } protected function tearDown() @@ -74,19 +44,13 @@ public function testGetSaveHandlerName() $this->assertNull($this->proxy->getSaveHandlerName()); } - /** - * @group legacy - */ public function testIsSessionHandlerInterface() { $this->assertFalse($this->proxy->isSessionHandlerInterface()); - $sh = new ConcreteSessionHandlerInterfaceProxy(); + $sh = new SessionHandlerProxy(new \SessionHandler()); $this->assertTrue($sh->isSessionHandlerInterface()); } - /** - * @group legacy - */ public function testIsWrapper() { $this->assertFalse($this->proxy->isWrapper()); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php index 682825356a724..fdd1dae254198 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php @@ -21,6 +21,7 @@ * * @runTestsInSeparateProcesses * @preserveGlobalState disabled + * @group legacy */ class SessionHandlerProxyTest extends TestCase { From fdfe60b5eadbab3fe94c752d5f9ef2d3a491c232 Mon Sep 17 00:00:00 2001 From: Alexandru Furculita Date: Mon, 25 Sep 2017 15:54:51 +0300 Subject: [PATCH 3/3] Remove deprecated classes from phpdoc; revert test changes --- .../Session/Storage/NativeSessionStorage.php | 12 ++++++------ .../Session/Storage/PhpBridgeSessionStorage.php | 6 ++---- .../Session/Storage/NativeSessionStorageTest.php | 12 ++++++------ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index f4d73bfbde8ef..48bef335bae31 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -39,7 +39,7 @@ class NativeSessionStorage implements SessionStorageInterface protected $closed = false; /** - * @var AbstractProxy + * @var AbstractProxy|\SessionHandlerInterface */ protected $saveHandler; @@ -92,9 +92,9 @@ 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 AbstractProxy|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag + * @param array $options Session configuration options + * @param \SessionHandlerInterface|null $handler + * @param MetadataBag $metaBag MetadataBag */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) { @@ -111,7 +111,7 @@ public function __construct(array $options = array(), $handler = null, MetadataB /** * Gets the save handler instance. * - * @return AbstractProxy + * @return AbstractProxy|\SessionHandlerInterface */ public function getSaveHandler() { @@ -362,7 +362,7 @@ public function setOptions(array $options) * @see http://php.net/sessionhandler * @see http://github.com/drak/NativeSession * - * @param AbstractProxy|\SessionHandlerInterface|null $saveHandler + * @param \SessionHandlerInterface|null $saveHandler * * @throws \InvalidArgumentException */ diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php index abdc0064cfbfc..662ed5015adec 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php @@ -11,8 +11,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; - /** * Allows session to be started by PHP and managed by Symfony. * @@ -21,8 +19,8 @@ class PhpBridgeSessionStorage extends NativeSessionStorage { /** - * @param AbstractProxy|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag + * @param \SessionHandlerInterface|null $handler + * @param MetadataBag $metaBag MetadataBag */ public function __construct($handler = null, MetadataBag $metaBag = null) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index a02aac8103755..818c63a9d2ae2 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -198,17 +198,17 @@ public function testSetSaveHandler() $this->iniSet('session.save_handler', 'files'); $storage = $this->getStorage(); $storage->setSaveHandler(); - $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(null); - $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(new SessionHandlerProxy(new NativeSessionHandler())); - $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(new NativeSessionHandler()); - $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(new SessionHandlerProxy(new NullSessionHandler())); - $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(new NullSessionHandler()); - $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); } /**