Did you know?
PHP 8.6 turns on session strict mode, HttpOnly cookies and SameSite=Lax by default.
After upgrading, test cross-site POST callbacks (payments, SSO): they may need SameSite=None with Secure.
- Web servers
- Applies to PHP 8.6 and later
- Last checked
Explained
PHP 8.6 changes three built-in session defaults to safer values:
session.use_strict_mode: 0 → 1. PHP rejects session IDs it did not create, which blocks session fixation.session.cookie_httponly: 0 → 1. JavaScript can no longer read the session cookie.session.cookie_samesite: empty →Lax. Browsers stop sending the cookie on cross-site POST requests.
Most applications only get safer, but three things can break: front-end code that reads the session cookie, payment or SSO providers that POST back to your site (the user arrives “logged out”), and code that passes a session ID that PHP never created. Check what a server uses with:
php -i | grep -E "session.(use_strict_mode|cookie_httponly|cookie_samesite)"If a cross-site callback really needs the cookie, set it explicitly for that app, for example session.cookie_samesite = None together with session.cookie_secure = 1 (browsers ignore None without Secure). Frameworks such as Laravel and Symfony set their own cookie options, so they are usually not affected.
Learn more
- PHP 8.6 Released: Partial Function Application, clamp() and Time\Duration Full guide · Updated Nov 2026
