Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 415ddf0

Browse filesBrowse files
committed
Deprecate SessonHanderProxy
1 parent 006e391 commit 415ddf0
Copy full SHA for 415ddf0

14 files changed

+36
-90
lines changed

‎UPGRADE-3.4.md

Copy file name to clipboardExpand all lines: UPGRADE-3.4.md
+4-10Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,13 @@ HttpFoundation
209209
class has been deprecated and will be removed in 4.0. Use the `\SessionHandler` class instead.
210210

211211
* The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy` class has been
212-
deprecated and will be removed in 4.0. Use the `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy`
213-
class instead.
212+
deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly.
214213

215214
* The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` class has been
216-
deprecated and will be removed in 4.0. Use the `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy`
217-
class instead.
215+
deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly.
218216

219-
* The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy::isSessionHandlerInterface()`
220-
method has been deprecated and will be removed in 4.0.
221-
222-
* The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy::isWrapper()`
223-
method has been deprecated and will be removed in 4.0. You can check explicitly if the proxy wraps
224-
a `\SessionHandler` instance.
217+
* The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` class has been
218+
deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly.
225219

226220
* `NativeSessionStorage::setSaveHandler()` now takes an instance of `\SessionHandlerInterface` as argument.
227221
Not passing it is deprecated and will throw a `TypeError` in 4.0.

‎UPGRADE-4.0.md

Copy file name to clipboardExpand all lines: UPGRADE-4.0.md
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,9 @@ HttpFoundation
520520
not supported anymore, use `Request::isMethodCacheable()` instead.
521521

522522
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler`,
523-
`Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy` and
524-
`Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` classes have been removed.
525-
526-
* The `SessionHandlerProxy::isSessionHandlerInterface()` and `SessionHandlerProxy::isWrapper()`
527-
methods have been removed.
523+
`Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy`,
524+
`Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` and
525+
`Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy` classes have been removed.
528526

529527
* `NativeSessionStorage::setSaveHandler()` now requires an instance of `\SessionHandlerInterface` as argument.
530528

‎src/Symfony/Component/HttpFoundation/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/CHANGELOG.md
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ CHANGELOG
55
-----
66

77
* deprecated the `NativeSessionHandler` class,
8-
* deprecated the `AbstractProxy` and `NativeProxy` classes in favor of `SessionHandlerProxy` class,
9-
* deprecated the `SessionHandlerProxy::isSessionHandlerInterface()` and `SessionHandlerProxy::isWrapper()` methods,
8+
* deprecated the `AbstractProxy`, `NativeProxy` and `SessionHandlerProxy` classes,
109
* deprecated setting session save handlers that do not implement `\SessionHandlerInterface` in `NativeSessionStorage::setSaveHandler()`
1110

1211
3.3.0

‎src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ class MetadataBag implements SessionBagInterface
5454
private $updateThreshold;
5555

5656
/**
57-
* Constructor.
58-
*
5957
* @param string $storageKey The key used to store bag in the session
6058
* @param int $updateThreshold The time to wait between two UPDATED updates
6159
*/

‎src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ class MockArraySessionStorage implements SessionStorageInterface
6363
protected $bags = array();
6464

6565
/**
66-
* Constructor.
67-
*
6866
* @param string $name Session name
6967
* @param MetadataBag $metaBag MetadataBag instance
7068
*/

‎src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class MockFileSessionStorage extends MockArraySessionStorage
3030
private $savePath;
3131

3232
/**
33-
* Constructor.
34-
*
3533
* @param string $savePath Path of directory to save session files
3634
* @param string $name Session name
3735
* @param MetadataBag $metaBag MetadataBag instance

‎src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
class NativeSessionStorage implements SessionStorageInterface
2525
{
2626
/**
27-
* Array of SessionBagInterface.
28-
*
2927
* @var SessionBagInterface[]
3028
*/
3129
protected $bags;
@@ -51,8 +49,6 @@ class NativeSessionStorage implements SessionStorageInterface
5149
protected $metadataBag;
5250

5351
/**
54-
* Constructor.
55-
*
5652
* Depending on how you want the storage driver to behave you probably
5753
* want to override this constructor entirely.
5854
*
@@ -378,6 +374,13 @@ public function setSaveHandler($saveHandler = null)
378374
throw new \InvalidArgumentException('Must be instance of AbstractProxy; implement \SessionHandlerInterface; or be null.');
379375
}
380376

377+
if ($saveHandler instanceof AbstractProxy) {
378+
@trigger_error(
379+
'Using session save handlers that are instances of AbstractProxy is deprecated since version 3.4 and will be removed in 4.0.',
380+
E_USER_DEPRECATED
381+
);
382+
}
383+
381384
// Wrap $saveHandler in proxy and prevent double wrapping of proxy
382385
if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
383386
$saveHandler = new SessionHandlerProxy($saveHandler);
@@ -388,8 +391,6 @@ public function setSaveHandler($saveHandler = null)
388391

389392
if ($this->saveHandler instanceof \SessionHandlerInterface) {
390393
session_set_save_handler($this->saveHandler, false);
391-
} else {
392-
@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);
393394
}
394395
}
395396

‎src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
class PhpBridgeSessionStorage extends NativeSessionStorage
2222
{
2323
/**
24-
* Constructor.
25-
*
2624
* @param AbstractProxy|\SessionHandlerInterface|null $handler
2725
* @param MetadataBag $metaBag MetadataBag
2826
*/

‎src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php
+3-11Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111

1212
namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
1313

14+
@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);
15+
1416
/**
15-
* @deprecated since version 3.4, to be removed in 4.0. Use SessionHandlerProxy instead.
17+
* @deprecated since version 3.4, to be removed in 4.0. Use your session handler implementation directly.
1618
*
1719
* @author Drak <drak@zikula.org>
1820
*/
@@ -21,8 +23,6 @@ abstract class AbstractProxy
2123
/**
2224
* Flag if handler wraps an internal PHP session handler (using \SessionHandler).
2325
*
24-
* @deprecated since version 3.4 and will be removed in 4.0.
25-
*
2626
* @var bool
2727
*/
2828
protected $wrapper = false;
@@ -45,28 +45,20 @@ public function getSaveHandlerName()
4545
/**
4646
* Is this proxy handler and instance of \SessionHandlerInterface.
4747
*
48-
* @deprecated since version 3.4 and will be removed in 4.0.
49-
*
5048
* @return bool
5149
*/
5250
public function isSessionHandlerInterface()
5351
{
54-
@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);
55-
5652
return $this instanceof \SessionHandlerInterface;
5753
}
5854

5955
/**
6056
* Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
6157
*
62-
* @deprecated since version 3.4 and will be removed in 4.0.
63-
*
6458
* @return bool
6559
*/
6660
public function isWrapper()
6761
{
68-
@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);
69-
7062
return $this->wrapper;
7163
}
7264

‎src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
1313

14-
@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);
14+
@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);
1515

1616
/**
1717
* This proxy is built-in session handlers in PHP 5.3.x.
1818
*
19-
* @deprecated since version 3.4, to be removed in 4.0. Use SessionHandlerProxy instead.
19+
* @deprecated since version 3.4, to be removed in 4.0. Use your session handler implementation directly.
2020
*
2121
* @author Drak <drak@zikula.org>
2222
*/

‎src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212
namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
1313

14+
@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);
15+
1416
/**
17+
* @deprecated since version 3.4, to be removed in 4.0. Use your session handler implementation directly.
18+
*
1519
* @author Drak <drak@zikula.org>
1620
*/
1721
class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,17 @@ public function testSetSaveHandler()
198198
$this->iniSet('session.save_handler', 'files');
199199
$storage = $this->getStorage();
200200
$storage->setSaveHandler();
201-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
201+
$this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler());
202202
$storage->setSaveHandler(null);
203-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
203+
$this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler());
204204
$storage->setSaveHandler(new SessionHandlerProxy(new NativeSessionHandler()));
205-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
205+
$this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler());
206206
$storage->setSaveHandler(new NativeSessionHandler());
207-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
207+
$this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler());
208208
$storage->setSaveHandler(new SessionHandlerProxy(new NullSessionHandler()));
209-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
209+
$this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler());
210210
$storage->setSaveHandler(new NullSessionHandler());
211-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler());
211+
$this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler());
212212
}
213213

214214
/**

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
+5-40Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,14 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
16+
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
1617

17-
// Note until PHPUnit_Mock_Objects 1.2 is released you cannot mock abstracts due to
18-
// https://github.com/sebastianbergmann/phpunit-mock-objects/issues/73
19-
class ConcreteProxy extends AbstractProxy
20-
{
21-
}
22-
23-
class ConcreteSessionHandlerInterfaceProxy extends AbstractProxy implements \SessionHandlerInterface
24-
{
25-
public function open($savePath, $sessionName)
26-
{
27-
}
28-
29-
public function close()
30-
{
31-
}
32-
33-
public function read($id)
34-
{
35-
}
36-
37-
public function write($id, $data)
38-
{
39-
}
40-
41-
public function destroy($id)
42-
{
43-
}
44-
45-
public function gc($maxlifetime)
46-
{
47-
}
48-
}
4918

5019
/**
5120
* Test class for AbstractProxy.
5221
*
22+
* @group legacy
23+
*
5324
* @author Drak <drak@zikula.org>
5425
*/
5526
class AbstractProxyTest extends TestCase
@@ -61,7 +32,7 @@ class AbstractProxyTest extends TestCase
6132

6233
protected function setUp()
6334
{
64-
$this->proxy = new ConcreteProxy();
35+
$this->proxy = $this->getMockForAbstractClass(AbstractProxy::class);
6536
}
6637

6738
protected function tearDown()
@@ -74,19 +45,13 @@ public function testGetSaveHandlerName()
7445
$this->assertNull($this->proxy->getSaveHandlerName());
7546
}
7647

77-
/**
78-
* @group legacy
79-
*/
8048
public function testIsSessionHandlerInterface()
8149
{
8250
$this->assertFalse($this->proxy->isSessionHandlerInterface());
83-
$sh = new ConcreteSessionHandlerInterfaceProxy();
51+
$sh = new SessionHandlerProxy(new \SessionHandler());
8452
$this->assertTrue($sh->isSessionHandlerInterface());
8553
}
8654

87-
/**
88-
* @group legacy
89-
*/
9055
public function testIsWrapper()
9156
{
9257
$this->assertFalse($this->proxy->isWrapper());

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*
2222
* @runTestsInSeparateProcesses
2323
* @preserveGlobalState disabled
24+
* @group legacy
2425
*/
2526
class SessionHandlerProxyTest extends TestCase
2627
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.