8000 [HttpFoundation] Remove dead code for emulating SameSite cookie by mbabker · Pull Request #41448 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation] Remove dead code for emulating SameSite cookie #41448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove dead code for emulating SameSite cookie
  • Loading branch information
mbabker committed May 29, 2021
commit a0a935a9470413eb1ffc360bc07650660dc660dd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Session\Storage;

use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
use Symfony\Component\HttpFoundation\Session\SessionUtils;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
Expand Down Expand Up @@ -54,11 +53,6 @@ class NativeSessionStorage implements SessionStorageInterface
*/
protected $metadataBag;

/**
* @var string|null
*/
private $emulateSameSite;

/**
* Depending on how you want the storage driver to behave you probably
* want to override this constructor entirely.
Expand Down Expand Up @@ -157,13 +151,6 @@ public function start()
throw new \RuntimeException('Failed to start the session.');
}

if (null !== $this->emulateSameSite) {
$originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this SessionUtils::popSessionCookie utility method still necessary then or should it also be removed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s still used elsewhere.

if (null !== $originalCookie) {
header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite), false);
}
}

$this->loadSession();

return true;
Expand Down Expand Up @@ -225,16 +212,7 @@ public function regenerate(bool $destroy = false, int $lifetime = null)
$this->metadataBag->stampNew();
}

$isRegenerated = session_regenerate_id($destroy);

if (null !== $this->emulateSameSite) {
$originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
if (null !== $originalCookie) {
header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite), false);
}
}

return $isRegenerated;
return session_regenerate_id($destroy);
}

/**
Expand Down
0