Skip to content

Commit

Permalink
bug #31338 Revert "bug #30620 [FrameworkBundle][HttpFoundation] make …
Browse files Browse the repository at this point in the history
…session service resettable (dmaicher)" (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

Revert "bug #30620 [FrameworkBundle][HttpFoundation] make session service resettable (dmaicher)"

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This reverts commit 029fb2e, reversing
changes made to 9dad29d.

Reverts #30620
Replaces #31215

We don't need to solve this in 3.4
Making the session resettable should be done on master, by implementing `ResetInterface`.
On 3.4 apps, one should write a dedicated `SessionResetter` that would implement the reverted logic.

Commits
-------

4177331 Revert "bug #30620 [FrameworkBundle][HttpFoundation] make session service resettable (dmaicher)"
  • Loading branch information
fabpot committed May 1, 2019
2 parents e0b5fb2 + 4177331 commit 9041637
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
Expand Up @@ -15,7 +15,6 @@
<argument type="service" id="session.storage" />
<argument type="service" id="session.attribute_bag" />
<argument type="service" id="session.flash_bag" />
<tag name="kernel.reset" method="save" />
</service>

<service id="Symfony\Component\HttpFoundation\Session\SessionInterface" alias="session" />
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/FrameworkBundle/composer.json
Expand Up @@ -23,7 +23,7 @@
"symfony/dependency-injection": "^3.4.24|^4.2.5",
"symfony/config": "~3.4|~4.0",
"symfony/event-dispatcher": "~3.4|~4.0",
"symfony/http-foundation": "^3.4.24|^4.2.5",
"symfony/http-foundation": "^3.3.11|~4.0",
"symfony/http-kernel": "~3.4|~4.0",
"symfony/polyfill-mbstring": "~1.0",
"symfony/filesystem": "~2.8|~3.0|~4.0",
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/HttpFoundation/Session/Session.php
Expand Up @@ -193,9 +193,7 @@ public function migrate($destroy = false, $lifetime = null)
*/
public function save()
{
if ($this->isStarted()) {
$this->storage->save();
}
$this->storage->save();
}

/**
Expand Down
10 changes: 0 additions & 10 deletions src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
Expand Up @@ -260,14 +260,4 @@ public function testIsEmpty()
$flash->get('hello');
$this->assertTrue($this->session->isEmpty());
}

public function testSaveIfNotStarted()
{
$storage = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface')->getMock();
$session = new Session($storage);

$storage->expects($this->once())->method('isStarted')->willReturn(false);
$storage->expects($this->never())->method('save');
$session->save();
}
}

0 comments on commit 9041637

Please sign in to comment.