Commit 7e7de025 authored by catch's avatar catch

Issue #2794089 by Wim Leers, yobottehg, slashrsm: SessionManager::destroy() is...

Issue #2794089 by Wim Leers, yobottehg, slashrsm: SessionManager::destroy() is incompatible with streamed responses: tries to send response header after headers have already been sent, causing watchdog to fill up with PHP warnings
parent fec70c8f
......@@ -257,7 +257,8 @@ public function destroy() {
// Unset the session cookies.
$session_name = $this->getName();
$cookies = $this->requestStack->getCurrentRequest()->cookies;
if ($cookies->has($session_name)) {
// setcookie() can only be called when headers are not yet sent.
if ($cookies->has($session_name) && !headers_sent()) {
$params = session_get_cookie_params();
setcookie($session_name, '', REQUEST_TIME - 3600, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
$cookies->remove($session_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment