bug #20375 [HttpFoundation][Session] Fix memcache session handler (klandaika)

This PR was merged into the 2.7 branch.

Discussion
----------

[HttpFoundation][Session] Fix memcache session handler

| Q             | A
| ------------- | ---
| Branch?       | 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 3.0, 3.1, master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commit 0216e05605 removed the opening of connection to memcached server on call to `open()`, because it's assumed that connection is already opened. However, `close()` still closes the connection. As a result no more read/write calls can be made if session got closed, as the connection does not get reestablished.

Basically MemcacheSessionHandler should follow same logic as Memcache**d**SessionHandler, which is exactly what this MR acomplishes.

Commits
-------

0423d894 [HttpFoundation][Session] memcached connection should not be closed
This commit is contained in:
Fabien Potencier 2016-11-04 08:14:52 -07:00
commit f37ac131e1
2 changed files with 1 additions and 7 deletions

View File

@ -71,7 +71,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface
*/
public function close()
{
return $this->memcache->close();
return true;
}
/**

View File

@ -56,12 +56,6 @@ class MemcacheSessionHandlerTest extends \PHPUnit_Framework_TestCase
public function testCloseSession()
{
$this->memcache
->expects($this->once())
->method('close')
->will($this->returnValue(true))
;
$this->assertTrue($this->storage->close());
}