PHP 8.6.0 came out on November 19, 2026. To move from PHP 8.5, read the changes below that touch your code, run your tests on 8.6 with deprecations visible, and pay particular attention to the new session defaults. PHP 8.6.0 removes no extensions. If you only need the security fixes released the same day, install the latest patch of your current branch instead: see our CVE-2026-126714 session vulnerability guide. Coming from 8.4? Our PHP 8.5 upgrade checklist covers that step.
The sources for this page are the PHP 8.6 release announcement, the 8.5 to 8.6 migration guide and the UPGRADING notes in the 8.6.0 source tag. Read them for your own extensions; this checklist selects what we think matters most.
Support dates for PHP 8.6
php.net's supported versions data gives these dates:
| Branch | Released | Active support until | Security support until |
|---|---|---|---|
| 8.6 | Nov 19, 2026 | Dec 31, 2028 | Dec 31, 2030 |
| 8.5 | Nov 20, 2025 | Dec 31, 2027 | Dec 31, 2029 |
| 8.4 | Nov 21, 2024 | Dec 31, 2026 | Dec 31, 2028 |
| 8.2 | Dec 8, 2022 | Dec 31, 2024 | Dec 31, 2026 |
PHP 8.2 loses security support at the end of this month. If you still run it, see our PHP 8.2 end of life guide.
New features worth knowing
Partial function application. A ? placeholder in a call returns a closure that takes the remaining arguments. See the RFC.
$atLeast86 = version_compare(?, '8.6', '>=');
var_dump($atLeast86('8.5.13')); // bool(false)
clamp(). Returns the value if it is in range, otherwise the nearest bound. It throws a ValueError if the minimum is above the maximum (RFC).
echo clamp(110, min: 0, max: 100); // 100
Time\Duration. An elapsed-time value independent of any time zone, with nanosecond precision (RFC). Durations are comparable, so min() and clamp() accept them.
use Time\Duration;
$timeout = Duration::fromSeconds(1)->add(Duration::fromMilliseconds(100));
$capped = min($timeout, Duration::fromSeconds(30));
Readonly property defaults. No new syntax: the old compile-time rejection of a default value is lifted (RFC).
final class Settings
{
public readonly int $retries = 3;
}
SortDirection enum. A shared type with Ascending and Descending cases, so libraries can stop inventing their own flags (RFC).
function orderBy(string $column, SortDirection $dir = SortDirection::Ascending): string
{
return $column . ($dir === SortDirection::Ascending ? ' ASC' : ' DESC');
}
Polling API. Io\Poll watches many streams with the best mechanism the platform offers (epoll, kqueue, event ports or WSAPoll) instead of stream_select(). It targets event-loop libraries such as ReactPHP and AMPHP more than application code (RFC).
use Io\Poll\{Context, Event};
$poll = new Context();
$poll->add(new StreamPollHandle($server), [Event::Read]);
foreach ($poll->wait() as $watcher) {
// handle $watcher->getHandle()
}
The upgrade notes list more: enum __debugInfo(), #[\Override] on class constants, a stream errors API, extra URI builders, and TLS session resumption options for OpenSSL streams.
Backward-incompatible changes to test first
The UPGRADING notes list far more than fits here. These are the ones most likely to affect an application:
- Session defaults.
session.use_strict_modeis now1,session.cookie_httponlyis now1andsession.cookie_samesiteis nowLax(RFC). JavaScript that reads the session cookie, custom handlers that accept externally supplied IDs, and cross-site POST flows that depend on the cookie need an explicit setting. trim(),ltrim(),rtrim()now strip the form feed character by default.preg_grep()returnsfalseinstead of a partial array when PCRE fails, for example on malformed UTF-8 with/u.fclose(),file_put_contents()andcopy()returnfalsewhen flushing or closing fails. Previously the failure was ignored, so code that never checked the result may now see errors.- NUL bytes. Many functions (the
file_exists()family,getenv(),parse_str(),proc_open()'s$cwdand others) throw aValueErrorfor strings containing NUL bytes. - Phar. A file is treated as a Phar archive on include only if
.pharappears as an extension in the file name component, not in a directory name. array_intersect()converts values to strings while scanning, which can change warnings and__toString()call order.unpack()reads<or>right after a format code as an endianness modifier, which changes keys such ass<value.SplFileObjectnext(),fgets()andseek()have different caching and end-of-file behavior, and DOM properties documented as readonly now use asymmetric visibility, so the error message for a write changes.
Deprecations to clear
Run your suite with error_reporting set to E_ALL and look for these (RFC for most):
returninsidefinally, and returning a value from__construct()or__destruct().- Naming things
let,isorreadonly, using_ornamespaceas a constant name, and a third argument todefine(). is_double(),is_long(),is_integer()anddoubleval(): useis_float(),is_int()andfloatval().spl_object_hash()(usespl_object_id()),spl_classes(),metaphone()andstrcoll().- Passing objects to
array_walk(),http_build_query()andmb_convert_variables(); convert withget_object_vars()first. - Mbregex in mbstring,
mysqli_get_charset(),mysqli_stmt_init(), and severalArrayIterator,SplFileObjectCSV and Reflection methods. - Session handlers: classes implementing
SessionHandlerInterfacewithoutcreate_sid()andvalidateId()now trigger a deprecation.
Ini and extension changes
The removed-extensions section of the notes is empty. On the ini side, error_include_args is new and off by default, mysqli.default_port is range-checked, mbstring.detect_order now takes effect when changed at runtime, and the three session defaults above changed. The mbstring Unicode tables moved to Unicode 18.0 and Fileinfo to file 5.48, so custom magic databases must be regenerated.
The upgrade checklist
- Record your baseline. Capture
php -v,php --iniandphp -mon the current runtime, and on the one that serves web requests. They can differ. - Check Composer. On 8.6, run
composer prohibits php 8.6andcomposer check-platform-reqs --lock. Ifcomposer.jsonsetsconfig.platform.php, change it deliberately, because it tells Composer which version to resolve for (Composer docs). Update blocked packages and review the lockfile diff. - Run static analysis. Run PHPStan, Psalm or Rector at the new target and fix deprecated calls from the list above.
- Extend the CI matrix. Add 8.6 as a non-blocking job first, keep your current version as the required job, then promote 8.6 when it passes with deprecations shown.
- Check extensions. Confirm each extension in your baseline
php -moutput loads on 8.6, including PECL ones. Do not assume a package exists for the new version. - Update Docker images. The official php image publishes 8.6 tags (
8.6-cli,8.6-fpm,8.6-apacheand Alpine variants). Pin an exact patch tag, rebuild and redeploy every container. - Test the session flows. Log in, log out, remember-me, uploads and any widget that reads the session cookie, with the new defaults.
- Roll out with a way back. Keep the previous image or package and lockfile. After release, watch error logs and worker output before declaring it done.
Reviewed on December 6, 2026 against php.net.