Refactored double Set-Cookie prevention code, and session reopening code

This commit is contained in:
Albert Santoni 2015-09-25 12:03:10 -04:00
parent 91c584ba16
commit 8b6833180d
8 changed files with 30 additions and 22 deletions

View file

@ -0,0 +1,13 @@
<?php
class SessionHelper
{
public static function reopenSessionForWriting() {
//PHP will send double Set-Cookie headers if we reopen the
//session for writing, and this breaks IE8 and some other browsers.
//This hacky workaround prevents double headers. Background here:
// https://bugs.php.net/bug.php?id=38104
ini_set('session.cache_limiter', null);
session_start(); // Reopen the session for writing (without resending the Set-Cookie header)
}
}