PHP 8.6 Session Defaults: Strict Mode, HttpOnly and SameSite Lax Are Now On, and What to Test Before You Upgrade
PHP 8.6 now turns on session strict mode, HttpOnly session cookies and SameSite "Lax" by default. The new defaults are safer. Test your logins before you upgrade if your app relied on the old ones.
Where Worldwide
On this page 7 sections
PHP 8.6 is out, and it changes how PHP handles login sessions out of the box. Session strict mode, HttpOnly session cookies and a SameSite setting of "Lax" are now on by default. The new defaults are safer, but if your website or web app depended on the old settings, people may have trouble logging in or staying logged in after you upgrade.
Help Net Security reported the release on November 19, 2026. Its advice is short: "If your app relied on the old defaults, test your login flows before you upgrade." This post covers what changed, what is confirmed, what is not known and how a business can check its own sites this week.
What changed in PHP 8.6 session defaults
The PHP project's UPGRADING notes list three session settings with new defaults:
| Setting | Old default | New default in PHP 8.6 |
|---|---|---|
| session.use_strict_mode | 0 (off) | 1 (on) |
| session.cookie_httponly | 0 (off) | 1 (on) |
| session.cookie_samesite | unset | "Lax" |
Here is what each one means in plain English.
session.use_strict_mode is now on
The notes say: "Strict mode rejects uninitialized session IDs, mitigating session fixation." Put simply, PHP will now refuse a session ID it did not create itself. Session fixation is a trick where an attacker gets a victim to use a session ID the attacker already knows.
session.cookie_httponly is now on
HttpOnly tells the browser not to let scripts on the page read the session cookie. The server can still use the cookie. Browser-side JavaScript can't.
session.cookie_samesite is now "Lax"
SameSite controls when the browser sends the session cookie on requests that start on a different website. Before, PHP left this unset. Now it sends "Lax".
Will PHP 8.6 break my login? What is confirmed and what is not
Confirmed:
- The three defaults above changed, according to the PHP project's UPGRADING notes.
- The proposal behind the change, a PHP RFC (request for comments) on session security defaults, is marked "Status: Accepted" and dated 2026-04-04.
- The RFC states its goal: "new PHP installations are secure out of the box, without requiring application code changes for the common case."
- Apps with their own custom session handler need to act. The UPGRADING notes say to "implement validateId() / create_sid() or explicitly set this to 0." Here, "this" means session.use_strict_mode.
- Help Net Security tells readers whose apps relied on the old defaults to test login flows before upgrading.
Not known from our sources:
- Which applications, frameworks or plugins will have problems. None of our sources lists affected software.
- The RFC's vote count. Our copy of the RFC page doesn't include the tally.
- The final PHP 8.6 release notes. The UPGRADING notes we checked are the copy tagged at an alpha build of PHP 8.6. Check the official changelog for the exact version you install.
This is a change to default settings, not a fix for a reported vulnerability. There is no attack to respond to. The work is testing before you upgrade.
Who needs to pay attention to the PHP 8.6 upgrade
Any business with a website, customer portal, online store or internal tool written in PHP should check before moving to 8.6. Pay the most attention if:
- Your app has a custom session handler, for example one that stores sessions in a database or cache.
- Your app's JavaScript reads the session cookie directly.
- Visitors log in or check out on a step that starts on another website.
- Nobody has looked at your php.ini or session code in years, so nobody knows which defaults the app depends on.
If a hosting company manages PHP for you, ask whether and when it plans to move your sites to 8.6. Our sources say nothing about hosting providers' schedules.
How to check your PHP session settings this week
Use this checklist before any site moves to PHP 8.6:
- Find the PHP version each site runs. On the server, run
php -v, or check your hosting control panel. The command line and the web server can use different settings files, so check what the website itself uses too. - Record your current session settings. Run
php -i | grep session, or use a temporary phpinfo() page and delete it right after. Note the values of session.use_strict_mode, session.cookie_httponly and session.cookie_samesite. - Find where they are set. Look in php.ini, any per-site config files and the app's code (for example ini_set or session_set_cookie_params calls). Settings the app sets on purpose are easier to reason about than settings it got by default.
- Check for a custom session handler. Search the code for session_set_save_handler or classes that handle sessions. If you find one, follow the PHP notes: implement validateId() / create_sid(), or explicitly set session.use_strict_mode to 0. Implementing the methods keeps the protection against session fixation. Turning strict mode off gives it up.
- Check for scripts that read the session cookie. With HttpOnly on, browser JavaScript can't read it. Any feature that relies on reading it needs a different approach.
- Test cross-site steps. Try every login or checkout step where the visitor arrives from another website, since the SameSite setting controls when the cookie is sent on those requests.
- Run the upgrade in staging first. Test login, logout, password reset, "remember me", account pages and checkout on PHP 8.6 before touching production.
- Upgrade production with a way back. Keep a tested rollback plan until real users have logged in without problems.
Why this matters for a business website
For most businesses, logins are where the money is: customers paying invoices in a portal, shoppers checking out and staff working in an admin panel. If sessions break after an upgrade, that looks like an outage to the people using the site, even though nothing was hacked.
The new defaults are worth having. Strict mode and HttpOnly cookies close off common session tricks, and the RFC's goal is that new installs are secure without extra work. Existing apps are different. Code written around the old defaults may need changes, and only testing tells you which. That is why upgrades need an owner, not a button someone clicks on a Friday afternoon. For more on that, see Who Is Patching the Software That Runs Your Business? and Updated Is Not the Same as Patched.
PHP 8.6 questions people are asking
When was PHP 8.6 released?
Help Net Security reported the PHP 8.6 release on November 19, 2026.
What are the new PHP 8.6 session defaults?
session.use_strict_mode is now 1 (was 0). session.cookie_httponly is now 1 (was 0). session.cookie_samesite is now "Lax" (was unset).
Does PHP 8.6 break existing apps?
It can, if an app relied on the old defaults. Our sources don't name affected apps. Test your login flows in staging before upgrading.
What is session.use_strict_mode?
It makes PHP reject session IDs it did not create. The PHP notes say this mitigates session fixation.
Do I need to change my custom session handler for PHP 8.6?
Yes, if you have one. The PHP notes say to implement validateId() / create_sid(), or explicitly set session.use_strict_mode to 0.
Should I switch the old defaults back on?
Only as a short-term fix while you repair the code. Turning strict mode off gives up its protection against session fixation. Fixing the handler or the feature is the better long-term answer.
Is PHP 8.6 a security patch?
Our sources describe new default settings in a new release, not a fix for a reported vulnerability.
The bigger lesson
Secure defaults protect new installs automatically, but they don't fix old code. Every app built around the old settings needs someone who knows where its sessions live, tests the upgrade and owns the rollback. An upgrade nobody tested is a gamble, even when the change makes things safer.
Want your PHP sites checked and upgraded safely? See security hardening or get a quote.
Get security alerts by email, plus our free checklist, at /security-alerts.
Sources: Help Net Security, PHP 8.6 released; PHP UPGRADING notes, php-src; PHP RFC: session security defaults.
Have a question about this article?
Ask it here and we will answer you directly by email. Questions are private, never posted.
Security alerts by email
Hear about the next one first.
When attackers start using a flaw in software businesses run on, we email what it is, whether it touches you and what to do that week, with a round-up of our latest security writing. Free, one-click unsubscribe. You get the checklist straight away: 12 things to secure this week.
Want a result like this?
Security alerts, breaches and the technology a business runs on: what happened, who it affects and what to do.
Get a Tech QuoteKeep reading
Webworm SoftEther VPN: Researchers Say a China-Aligned Group Hid a Rebranded VPN Bridge Called NtMonitor in Government Networks, and How to Check Your Own Machines
Rapid7 says Webworm, a China-aligned group, hid a modified SoftEther VPN Bridge renamed NtMonitor VPN in gover...
CISA Exploited Vulnerabilities: SAP NetWeaver, VMware vCenter and Apache Roller Join Cisco Expressway on the KEV List, What Is Confirmed and What to Patch This Week
CISA added four actively exploited flaws to its KEV catalog on November 20, 2026: SAP NetWeaver, Cisco Express...
Oracle November 2026 Patches: 655 Fixes, 62 Critical Flaws, Just Over 300 No-Login Remote Bugs and Java4Shell CVE-2026-114938
Oracle released 655 security patches on November 17, 2026. 62 fix critical flaws and just over 300 fix flaws t...