PHP 8.6 is out: patch 8.2 to 8.5 today, test your sessions before you upgrade

PHP 8.6 is out: patch 8.2 to 8.5 today, test your sessions before you upgrade

PHP 8.6.0 came out on 19 November 2026. It's this year's feature release, and the PHP team calls it a major update to the language. The new stuff: partial function application, a Time\Duration class, an Io\Poll API for watching streams, clamp(), a SortDirection enum and default values for readonly properties. Good additions, and you can adopt every one of them at your own pace.

On the same day the project shipped security releases for all four older branches, from 8.2.36 up to 8.5.13. Two of the advisories behind them are rated Critical. One is a use-after-free in how PHP collects arguments for backtraces of __call() and __callStatic() methods, which only affects 8.5. The other is a request smuggling bug in PHP-FPM: body bytes from php://input that a script never read can get reused on a persistent FastCGI or LSAPI connection. That one goes all the way back to 8.2.

So you have two separate jobs this week, and I'd keep them apart. Patch now. Move to 8.6 later, after testing.

Patch first, today

If you run an older branch, take its new patch release: 8.2 goes to 8.2.36, 8.3 goes to 8.3.37, 8.4 goes to 8.4.28, and 8.5 goes to 8.5.13. The PHP team says the Critical issues need either non-default configuration or an uncommon setup to be exploitable. That's good to hear, but I wouldn't lean on it too hard. In our pentesting engagements, "uncommon setup" describes a surprising number of production stacks. Someone tuned the connection between the web server and FPM three years ago to shave a few milliseconds, and nobody remembers doing it.

From our PHP and Docker work, the upgrade itself is rarely the slow part. Finding every place PHP actually runs is. The main app image gets bumped, while the queue worker, the cron container and the old admin panel sit on a stale base image for another six months. Before you close the ticket, check the version inside every running container, not just what the Dockerfile says:

docker ps --format '{{.Names}}' | xargs -I{} docker exec {} php -v

Containers without PHP will just throw an error, so ignore those. And if your base image tag only pins the minor version, rebuild anyway. A cached layer won't pick up the patch on its own.

The 8.6 change that will bite: session defaults

The feature list gets the attention, but the part of the 8.6 upgrade notes I'd read twice is about sessions. Three INI defaults change:

  • session.use_strict_mode goes from 0 to 1
  • session.cookie_httponly goes from 0 to 1
  • session.cookie_samesite goes from unset to Lax

On security grounds I like all three. We've been setting them by hand on client projects for years, and a session cookie missing HttpOnly or SameSite is one of the most common low-severity findings in our pentest reports. Making them the default is the right call.

The catch is Lax. With SameSite set to Lax, the browser won't send the session cookie on a cross-site POST. Now think about every place a user comes back to your site through a POST from somewhere else. A payment provider returning the user after card verification. A SAML identity provider posting an assertion. A partner site handing a customer over. With our travel-platform clients, the payment return step is exactly where this kind of change shows up first. The user pays, lands on your confirmation page without a session and looks logged out. Nothing in the error log, just support tickets and abandoned bookings.

The upgrade notes spell out the fix: if your app needs session cookies on cross-site POSTs, set session.cookie_samesite to "None" and session.cookie_secure to 1 explicitly. My advice is narrower than that. Don't flip the whole app to None because one callback broke. If the provider allows it, have the return go through a GET redirect, or put a signed, short-lived token in the callback and restore the session on the server. Keep None for the cases where you really have no other choice.

HttpOnly breaks things in its own way. In our native iOS and Android projects we still run into hybrid screens: a WebView wrapping part of a PHP web app, with a bit of JavaScript reading the session cookie and passing it to native code. With HttpOnly on, that script gets nothing. It was never a great pattern, but it will fail quietly, usually on the one screen nobody tested.

Strict mode should go unnoticed in most apps. It can surprise you if anything hands PHP a session ID it didn't create itself, for example a mobile client passing an ID along so a WebView can share the same session. Test that path too.

A smaller one: trim()

In 8.6 the default character mask of trim(), ltrim() and rtrim() includes the form feed character (\f). Most code won't care. Code that trims text and then compares it to stored values might, especially imports from legacy systems or text extracted from documents. Grepping your parsing and comparison code for trim calls costs an hour at most.

What we'd do this week

  1. Patch every PHP 8.2 to 8.5 runtime to its new release, then confirm the version inside the running containers.
  2. Before touching 8.6, write the session settings you depend on into your ini files explicitly, so a changed default can't surprise you. Run php -i | grep session to see current values, but remember the CLI and FPM often load different ini files, so check the FPM side through a protected phpinfo() page as well.
  3. List every flow where a third party POSTs a user back to you. Test each one on 8.6 in staging, in a real browser, against the provider's sandbox.
  4. Then enjoy the new features. Partial function application and Time\Duration will tidy up a lot of code, and none of that is urgent.

We do a lot of these version bumps as part of our web and mobile development work, and the session-return problem has come up on more than one project in our portfolio. It's never hard to fix. It's just hard to spot before your users do.

If a payment return or SSO callback that quietly drops the session sounds familiar, let's talk.

expert-analysisphpphp-8-6release-upgradesession-securitytech-news