Skip to content
Web Development Guides Laravel

PHP 8.6: New Features, Deprecations and When to Upgrade

Shakewell ·

PHP 8.6 was released on 19 November 2026. Its headline additions are partial function application, a Time\Duration class, a Polling API and a clamp() function. It is not an async release, and most frameworks and CMSs do not yet list it as supported.

Here is what is new, what is deprecated or breaks, where Laravel, WordPress, Magento and Drupal stand, and how to check your own code. Everything below comes from php.net, the PHP RFC wiki and each vendor’s own documentation, checked in November 2026.

PHP 8.6 release date and support dates

Version Released Active support ends Security support ends Status today
8.2 8 December 2022 31 December 2024 31 December 2026 Security fixes only
8.3 23 November 2023 31 December 2025 31 December 2027 Security fixes only
8.4 21 November 2024 31 December 2026 31 December 2028 Active support
8.5 20 November 2025 31 December 2027 31 December 2029 Active support
8.6 19 November 2026 31 December 2028 31 December 2030 Active support

Each branch gets two years of active support and two more of security fixes. Our PHP 8.2 end of life guide has the full picture for the version that expires next.

New features in PHP 8.6

These are the changes most teams will notice.

Partial function application

A ? placeholder stands for one missing argument and ... for all the remaining ones. The result is a Closure.

function add(int $a, int $b, int $c = 0): int
{
    return $a + $b + $c;
}

$addOne = add(1, ?);
var_dump($addOne(5)); // int(6)

$stripSpaces = str_replace(' ', '', ?);
var_dump($stripSpaces('a b c')); // string(3) "abc"

It replaces many one-line wrapper closures.

clamp()

var_dump(clamp(110, 0, 100)); // int(100)
var_dump(clamp(-10, 0, 100)); // int(0)

It returns the value, or the nearest boundary. Any comparable value works, including the new Duration class.

Time\Duration

An immutable, comparable length of elapsed time with nanosecond precision and no calendar units. It has factories such as fromSeconds() and fromMilliseconds(), arithmetic (add(), sub(), multiplyBy(), divideBy()) and compare(). It throws Time\TimeException for durations beyond roughly 292 years.

Readonly property defaults

Readonly properties, including those in readonly classes, can now have a default value. The default counts as initialisation, so the constructor cannot overwrite it.

class Config
{
    public readonly int $timeout = 30;
}

Polling API

The new Io\Poll\Context class watches many streams and uses epoll, kqueue, event ports or WSAPoll depending on the platform. php.net presents it as the foundation for event loop libraries, and it avoids the roughly 1024-connection limit of stream_select(). See the async section below.

Stream error handling

Stream functions can now throw a StreamException or fail quietly instead of emitting warnings. Errors become StreamError objects with a StreamErrorCode enum case, the wrapper name and the path. Set the error_mode stream context option to opt in.

Smaller additions

  • A SortDirection enum with Ascending and Descending cases.
  • #[\Override] works on class constants and enum cases.
  • Enums can define __debugInfo().
  • ReflectionProperty::isReadable() and isWritable(), and ReflectionParameter::getDocComment().
  • Objects held in constants can be modified, as in CONFIG->debug = true.
  • pack() and unpack() accept < and > endianness modifiers.
  • Sodium gains post-quantum key encapsulation (X-Wing and ML-KEM-768), and TLS streams support session resumption and 0-RTT early data.

Is async in PHP 8.6?

No.

What 8.6 ships is the Polling API, which gives event loop libraries a better way to wait on many sockets. It does not add async and await or a built-in scheduler. Fibers, the language feature behind libraries such as ReactPHP and AMPHP, arrived in PHP 8.1. A “Concurrency Support in the PHP Engine” RFC was still under discussion on wiki.php.net in November 2026 and is not listed for 8.6.

For your code: nothing changes unless you maintain an event loop or a socket server.

PHP 8.6 performance

php.net’s release page names specific engine changes:

  • array_map() with a first-class callable or partial application callback is compiled into a loop.
  • printf() is faster.
  • Stateless closures are cached.
  • JSON encoding is faster.

It publishes no benchmark figures, so we will not quote one. Measure your own workload on a staging server.

Deprecations in PHP 8.6

Deprecated code still runs and logs an E_DEPRECATED notice. The ones most likely to appear in an existing codebase:

Deprecated Use instead
return inside a finally block Move the return out of finally
Returning a value from __construct() or __destruct(), or making them generators A bare return;
is_double(), is_long(), is_integer(), doubleval() is_float(), is_int(), floatval()
spl_object_hash() spl_object_id()
define() with a third case_insensitive argument Omit the argument
mbstring regex functions (mb_ereg(), mb_split() and the rest) PCRE with the u modifier
strcoll() and SORT_LOCALE_STRING Collator from the intl extension
metaphone() A userland library
mysqli_stmt_init(), mysqli_get_charset() mysqli_prepare(), mysqli_character_set_name()
Objects passed to array_walk() or http_build_query() get_object_vars() first

The finally case is a real bug waiting to happen. php.net’s example:

function getConfig(): array
{
    try {
        return loadConfig(); // throws if the file is missing
    } finally {
        return []; // Deprecated: the exception is gone, the caller just gets []
    }
}

Also deprecated: using let, is or _ as a class, function or constant name, a function named readonly, a class constant named namespace, and several ArrayIterator and SplFileObject CSV methods. php.net says the mbregex functions will be removed in PHP 9.0.

Backward-incompatible changes

These change behaviour without a deprecation notice, so they are the ones that bite.

  • Session defaults are stricter. session.use_strict_mode is now 1 and session.cookie_httponly is 1. session.cookie_samesite is now Lax. Our post on PHP 8.6 session defaults covers what breaks and how to fix it. Custom session handlers that accept externally supplied IDs must implement validateId() and create_sid(), or you set strict mode back to 0. If JavaScript reads your session cookie, or a payment or SSO flow posts across sites, test it.
  • trim(), ltrim() and rtrim() now strip form feed (\f) by default.
  • NUL bytes and out-of-range values throw a ValueError in many functions that used to truncate or clamp silently, including file_exists(), is_file(), filesize(), getenv(), parse_str(), sleep() and usleep().
  • ?? and empty() on magic properties no longer call __get() when __isset() has already written the value into the property table.
  • preg_grep() returns false on a PCRE execution error instead of a partial array.
  • unpack('s<value', ...): a < or > after a format code is now an endianness modifier, not the start of the key name.

The full list is in the migration guide.

Does your stack support PHP 8.6 yet?

As at November 2026, from each project’s own page:

Platform PHP 8.6 status What it lists
Laravel 12 Not listed PHP 8.2 to 8.5
Laravel 13 Not listed PHP 8.3 to 8.5
WordPress Not listed PHP 8.5 marked supported from 6.9; the compatibility table has no 8.6 column
Drupal None yet PHP 8.5 on Drupal 11.3, 11.4 and 12.0; PHP 8.6 is tracked in a drupal.org issue
Magento 2.4.9 Not listed PHP 8.5 only
Magento 2.4.8 and 2.4.7 Not listed 8.3 and 8.4, and 8.2 and 8.3
Symfony No statement Releases page lists minimum PHP only
Composer Being fixed 2.10.3 and 2.11.1 release notes mention fixing PHP 8.6 deprecation warnings

The Laravel row means the documentation, not the code. A framework can work on a new PHP before it says so, but unlisted means unsupported, and you carry the risk. Our Laravel upgrade guide covers the framework side, and the Magento 2.4.9 upgrade guide covers Adobe’s stack.

When to move to PHP 8.6

Wait for your framework. The newest version your platform lists is the right target. In practice:

  • On PHP 8.2 or older: do not skip to 8.6. Move to 8.4 or 8.5 now, because 8.2’s security support ends on 31 December 2026.
  • On PHP 8.3 to 8.5 with Laravel 12 or 13: stay put until Laravel’s documentation lists 8.6, then trial it on staging.
  • On Magento: 2.4.9 lists 8.5 only. Treat 8.6 as a 2027 question.
  • On a custom application or one you own end to end: you can trial 8.6 on a branch today, which is also the cheapest way to find out what it breaks.

PHP 8.6 upgrade checklist

Run these on a copy of your project, not production.

1. Find the blockers

composer why-not php 8.6
composer outdated --direct

why-not is an alias of prohibits. It lists the installed packages whose PHP requirement excludes 8.6. Each is a package to update, replace or remove. If the list is empty, the packages declare support, but that is a statement, not a test.

2. Scan the code

PHPCompatibility is community tooling, not part of PHP, and we have not confirmed how complete its PHP 8.6 rules are. Its README installs the 10.0 development version:

composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev phpcompatibility/php-compatibility:"^10.0.0@dev"
vendor/bin/phpcs -p . --standard=PHPCompatibility --runtime-set testVersion 8.6- --ignore=*/vendor/*,*/node_modules/*

Its README says coverage of PHP changes is not yet 100%, so treat a clean run as a first filter and confirm against the deprecation table above.

3. Let Rector do the mechanical fixes

Rector’s source on GitHub has a php86 flag with rules for the renamed aliases (is_integer() to is_int()), the define() argument, min() and max() pairs to clamp() and constructor-assigned readonly defaults. Preview first, and confirm your installed Rector version has the flag:

// rector.php
return RectorConfig::configure()
    ->withPhpSets(php86: true);
vendor/bin/rector process --dry-run

Rector’s own documentation pages did not list a PHP 8.6 set when we checked, so verify the flag in the version you install.

4. Run it with errors turned up

Run the test suite on PHP 8.6 with error_reporting at E_ALL and deprecations logged. Then test what automated suites miss: logins and sessions (because of the new defaults), checkout, imports, scheduled jobs and queue workers. Workers do not always use the same PHP binary as the website.

5. Confirm the platform

On the target server, composer check-platform-reqs checks the PHP version and extensions against what your installed packages declare. Then deploy to staging on the same PHP build as production, and keep the old version installed so you can switch back.

A note for Australian businesses

PHP 8.2’s security support ends on 31 December 2026, in the middle of the Christmas shutdown for many teams. If you run 8.2, the useful work this month is the dependency audit above, targeted at PHP 8.4 or 8.5, not PHP 8.6. If you hold card data, ask your host when it removes 8.2 and talk to your assessor about the date.

If you need help, our PHP developers in Sydney do these upgrades, including Laravel upgrades and wider framework upgrades. If nobody currently owns the codebase, start with what the first two weeks of an inherited PHP application look like. More on our PHP development work.


Sources: PHP 8.6 release announcement, PHP 8.6 new features, PHP 8.6 deprecated features, PHP 8.6 backward incompatible changes and Supported versions (PHP), PHP RFC list (PHP wiki), Laravel release notes and support policy (Laravel), PHP compatibility and WordPress versions (WordPress), Drupal PHP requirements (Drupal), Symfony releases (Symfony), Adobe Commerce system requirements (Adobe), Composer command-line interface and Composer releases, PHPCompatibility and Rector (all checked November 2026).

Common questions

When was PHP 8.6 released?

PHP 8.6 was released on 19 November 2026. php.net lists active support, with regular bug and security fixes, until 31 December 2028, and security-only support until 31 December 2030. Release day is not upgrade day: most production sites should wait until their framework, CMS and extensions list 8.6 as supported.

Does PHP 8.6 have async?

No. PHP 8.6 adds a Polling API (Io\Poll) that watches many streams at once, which is a foundation for event loop libraries such as ReactPHP and AMPHP. It does not add async and await or change how PHP code runs. Fibers arrived in PHP 8.1. A broader concurrency RFC was still under discussion on wiki.php.net in November 2026 and is not listed for 8.6.

Is PHP 8.6 faster than PHP 8.5?

php.net does not publish benchmark figures for 8.6. Its release page lists specific engine optimisations: array_map() with certain callbacks compiled into loops, faster printf() and JSON encoding, and cached stateless closures. Any speed-up for your application depends on how much of that code it runs, so measure on your own workload before quoting a number.

Should we upgrade to PHP 8.6 now?

Only if your framework, CMS and every extension already support it. In November 2026 Laravel's documentation lists PHP 8.5 as the newest version for Laravel 12 and 13, Adobe lists PHP 8.5 for Magento 2.4.9, and Drupal lists no supported version on 8.6. If you are on PHP 8.2, which loses security fixes on 31 December 2026, move to 8.4 or 8.5 now and plan 8.6 for 2027.

Start a conversation

Start a conversation

Tell us what you want to build, fix or scale, we’ll come back with a clear way forward.