PHP 8.6 was released on November 19, 2026 with partial function application, a native polling API, and secure session cookies by default. That last change is the one most likely to break something when updating, so this guide covers both what’s new and what’s worth reviewing beforehand.
Besides, there’s a deadline. According to the supported versions table on php.net, PHP 8.2 stops receiving security patches on December 31, 2026. If you’re still on 8.2, the question is no longer whether to update, but which version to target: 8.6 has security support until December 31, 2030 (and active support until December 31, 2028).
What’s new in PHP 8.6?
PHP 8.6 brings around a dozen highlighted features, and two of them change code you write every day. The rest matters depending on what you build.
What is partial function application in PHP?
Partial function application lets you now pass some arguments to a function and the rest later. You mark the missing arguments with ? (or with ... for “everything else”) and PHP returns a Closure instead of calling the function. The function only executes when the missing arguments arrive.
The official example replaces the arrow function you’d normally write for array_filter():
$versions = ['8.4', '8.5', '8.6', '8.7', '9.0'];
$supportsPfa = array_filter(
$versions,
version_compare(?, '8.6', '>='),
);
Before 8.6, that second argument would be fn($v) => version_compare($v, '8.6', '>='). It also works with named arguments, making it useful for preconfiguring functions with multiple parameters:
$waitBeforeRetry = backoff(
Duration::fromSeconds(1),
Duration::fromMilliseconds(100),
attempt: ?,
);
$waitBeforeRetry($attempt);
The release notes also mention a performance improvement tied to this: calls to array_map() with first-class callable or partial application callbacks are now compiled as loops. At the time this note was published, php.net didn’t provide benchmark figures for this improvement or for the other optimizations it announces.
What is Io\Poll and why does it replace stream_select()?
Io\Poll is a new API for watching many streams at once. It automatically uses the best mechanism for each platform (epoll, kqueue, event ports, or WSAPoll) instead of select(), which according to php.net normally can’t handle more than 1,024 connections. It’s intended as a common foundation for event loop libraries like ReactPHP and AMPHP.
This is the echo server from the release notes:
use Io\Poll\{Context, Event};
$server = stream_socket_server('tcp://0.0.0.0:8080');
// Automatically uses epoll, kqueue, event ports, or WSAPoll
$poll = new Context();
$poll->add(new StreamPollHandle($server), [Event::Read]);
while (true) {
foreach ($poll->wait() as $watcher) {
$stream = $watcher->getHandle()->getStream();
if ($stream === $server) {
$client = stream_socket_accept($server);
$poll->add(
new StreamPollHandle($client),
[Event::Read],
);
continue;
}
$data = fread($stream, 8192);
if ($data === '' || $data === false) {
$watcher->remove();
fclose($stream);
} else {
fwrite($stream, $data);
}
}
}
Most application developers will use Io\Poll indirectly, through the async library they already use, rather than calling it directly.
What are Duration, clamp(), and SortDirection for?
These three additions eliminate boilerplate code you’ve probably written before:
\Time\Durationrepresents elapsed time, independent of any clock or timezone, with nanosecond precision over a range of more than 250 years. Durations are comparable, somin()andmax()work directly with them. It’s intended for timeouts and benchmark measurements.clamp()keeps a value within a range:clamp(110, 0, 100)returns100andclamp(-10, 0, 100)returns0. It works with any comparable value, includingDuration.SortDirectionis a built-in enum with casesAscendingandDescending, so libraries can type their sorting parameters instead of accepting magic integers. PassingSORT_STRINGto a parameter typed asSortDirectionthrows aTypeError.
var_dump(clamp(
\Time\Duration::fromSeconds(30),
min: \Time\Duration::fromMinutes(1),
max: \Time\Duration::fromMinutes(10),
)->seconds);
// int(60)
What else changes in PHP 8.6?
- Default values in readonly properties. Instance readonly properties, including those in readonly classes, can declare a default value. That value counts as initialization, so the constructor can’t overwrite it.
- Stream errors as exceptions. If you set
'error_mode' => StreamErrorMode::Exceptionin a stream context, operations likefile_get_contents()throw aStreamExceptionwith structuredStreamErrorobjects, instead of emitting warnings. - Post-quantum cryptography in Sodium: X-Wing key encapsulation and ML-KEM-768, plus IP address encryption and SHAKE and TurboSHAKE functions.
mysqli::quote_string(), equivalent toPDO::quote().- JSON error messages now indicate where in the input the error is.
#[\Override]can now be applied to class constants and enum cases.
What can break when updating to PHP 8.6?
This is the section worth reading before changing your Docker image or asking your host to switch versions.
Why might sessions stop working after updating?
Three session default values changed, according to the Backward Incompatible Changes page in the migration guide. Each is a security improvement, and each can break an application that relied on the old behavior:
| Directive | Before | PHP 8.6 | What breaks | How to recover the old behavior |
|---|---|---|---|---|
session.use_strict_mode |
0 |
1 |
Custom session handlers that accept external IDs without storage entries | Implement validateId() and create_sid(), or revert to 0 |
session.cookie_httponly |
0 |
1 |
JavaScript that reads the session cookie | Revert to 0 |
session.cookie_samesite |
undefined | "Lax" |
Cross-site POST no longer sends the session cookie | Use "None" and set session.cookie_secure to 1 |
The SameSite change is the one that can bring the most surprises. Any flow where another domain does a POST back to your application and expects to find the user’s session (some SSO integrations and some payment gateway return URLs work this way) will arrive without the session cookie. The user appears logged out, or the request can’t be associated with their cart.
A practical way to know beforehand: all three directives already exist in current versions of PHP 8, so you can set them to the new values in your staging environment, in the version you use today, and see what breaks. If nothing breaks, the sessions part of the update won’t be a problem.
Which deprecated functions are worth fixing first?
The deprecation list is long. These are the ones most likely to appear in an existing project:
returninside afinallyblock. Silently discards exceptions and overwrites return values, which is exactly why it’s deprecated. If you find one, it probably hides a bug.- mbstring regex functions, like
mb_ereg()andmb_split(). The Oniguruma library that supports them is no longer maintained. Use PCRE (preg_*) with theumodifier. - Type checking aliases
is_double(),is_long(),is_integer()anddoubleval(). Replace them withis_float(),is_int()andfloatval(). spl_object_hash(): usespl_object_id()instead.- Custom session handlers that don’t implement both
create_sid()andvalidateId().
Deprecated functions still work in 8.6: they just emit notices. But they’ll be removed in a future major version, and a log full of deprecation notices hides the warnings that do matter.
What behavior changes can alter results without warning?
Some changes throw nothing; they just return something different:
trim(),ltrim()andrtrim()now also remove the form feed character (\f) by default.fclose(),file_put_contents()andcopy()returnfalsewhen buffer flushing or closing fails.- Many functions now throw
ValueErrorfor out-of-range values, invalid flags, or strings with NUL bytes, includingfile_exists(),is_file(),getenv()andnumber_format().
The complete list, extension by extension, is in the migration guide:
When does PHP 8.2 support end?
PHP 8.2 stops receiving security patches on December 31, 2026 (its end of life, according to php.net). After that date, if a new PHP vulnerability appears, there will be no official patch for that branch. We already saw what that means in practice with CVE-2026-109618 and CVE-2026-109619.
These are the support dates for the supported branches:
| Version | Release | Active support until | Security support until |
|---|---|---|---|
| 8.2 | Dec 8, 2022 | Dec 31, 2024 | Dec 31, 2026 |
| 8.3 | Nov 23, 2023 | Dec 31, 2025 | Dec 31, 2027 |
| 8.4 | Nov 21, 2024 | Dec 31, 2026 | Dec 31, 2028 |
| 8.5 | Nov 20, 2025 | Dec 31, 2027 | Dec 31, 2029 |
| 8.6 | Nov 19, 2026 | Dec 31, 2028 | Dec 31, 2030 |
Is it worth updating PHP to 8.6 now?
If you’re on 8.2, yes: plan the change before December 31, and jumping straight to 8.6 gives you the longest available support window.
If you’re on 8.4 or 8.5, there’s no rush, because both have several more years of support. Still, it’s worth testing the new session values now, because they’ll apply whenever you update.
In any case, start with the backward incompatible changes page in the migration guide and the three session directives above. Partial function application will be the part you enjoy; the default SameSite, the part you test.
What about you? Which PHP 8.6 change will you try first in your code?
- PHP 8.4 or 8.5
- PHP 8.2 or 8.3
- PHP 8.1 or earlier
- Another situation (tell us which)
Comment below or, if this article reached you by email, reply directly to it: your reply gets published here.
Related: CVE-2026-109618 and CVE-2026-109619: Which PHP version do you need and when does the patch come out?