PHP 8.6.0 was officially released on November 19, 2026. The new branch introduces several notable improvements for PHP developers, including Partial Function Application, the new Time\Duration class, an I/O polling API, the clamp() function, the SortDirection enum, default values for readonly properties, improved stream error handling and a large number of additions across PHP's standard extensions.
For Drupal developers, however, there is an important distinction to make: PHP 8.6 is stable on the PHP side, but official Drupal support is still being finalized at the time of writing.
This article covers the most useful PHP 8.6 features, backward-compatibility changes, deprecations, performance and security improvements, and the recommended migration strategy for PHP, Symfony and Drupal projects.
PHP 8.6 at a glance
| Item | PHP 8.6 |
|---|---|
| Release date | November 19, 2026 |
| Active support | Until December 31, 2028 |
| Security support | Until December 31, 2030 |
| Previous branch | PHP 8.5 |
| Drupal status on November 20, 2026 | Official PHP 8.6 support still in progress |
PHP 8.6 receives two years of active support followed by two additional years of critical security support.
Partial Function Application
One of the most visible additions in PHP 8.6 is Partial Function Application, commonly shortened to PFA.
It lets developers provide some function arguments in advance and receive a Closure that accepts the missing arguments later.
PHP 8.6 provides two placeholders:
?represents exactly one argument that will be supplied later;...represents all remaining arguments.
Before PHP 8.6, this would usually require an arrow function:
$versions = ['8.4', '8.5', '8.6'];
$supported = array_filter(
$versions,
fn (string $version): bool => version_compare($version, '8.6', '>='),
);With PHP 8.6:
$versions = ['8.4', '8.5', '8.6'];
$supported = array_filter(
$versions,
version_compare(?, '8.6', '>='),
);You can also preconfigure part of your own function calls:
function formatPrice(float $amount, string $currency): string
{
return number_format($amount, 2) . ' ' . $currency;
}
$formatEuro = formatPrice(?, 'EUR');
echo $formatEuro(49.90);This syntax is particularly useful for callbacks, functional transformations and APIs where a short closure only existed to forward arguments to another function.
The new Time\Duration class
PHP 8.6 introduces Time\Duration, an immutable value object representing a fixed amount of elapsed time.
This differs from DateInterval. Calendar units such as a month or a day may have different actual durations depending on the calendar. Time\Duration instead represents an unambiguous elapsed duration with nanosecond precision.
use Time\Duration;
$timeout = Duration::fromSeconds(5);
$retryDelay = Duration::fromMilliseconds(250);
$total = $timeout->add($retryDelay);
var_dump($total->seconds);
var_dump($total->nanoseconds);Durations can be compared and manipulated through methods such as add(), sub(), multiplyBy(), divideBy(), negate() and absolute().
The API is a natural fit for timeouts, retries, benchmark timings, workers, queues and asynchronous applications.
A new Io\Poll API for concurrent applications
PHP 8.6 introduces an I/O polling API designed to efficiently monitor multiple streams and I/O resources.
The Io\Poll API can use native operating-system mechanisms such as epoll, kqueue or WSAPoll. It provides a more scalable foundation than stream_select() for event loops and highly concurrent workloads.
use Io\Poll\Context;
use Io\Poll\Event;
$poll = new Context();
$poll->add(
new StreamPollHandle($stream),
[Event::Read],
);
foreach ($poll->wait() as $watcher) {
$stream = $watcher->getHandle()->getStream();
// Process the ready stream.
}This addition is mainly relevant to asynchronous runtimes, application servers and event-loop libraries such as ReactPHP or AMPHP. A conventional Drupal site running through PHP-FPM is unlikely to see a direct short-term impact from this API.
The new clamp() function
PHP now has a native clamp() function for keeping a value within a minimum and maximum range.
Before PHP 8.6:
$value = max(0, min($value, 100));With PHP 8.6:
$value = clamp($value, 0, 100);For example:
var_dump(clamp(-10, 0, 100));
// int(0)
var_dump(clamp(50, 0, 100));
// int(50)
var_dump(clamp(150, 0, 100));
// int(100)clamp() works with comparable values and is not limited to integers.
A native SortDirection enum
PHP 8.6 introduces a global SortDirection enum with two cases:
SortDirection::Ascending
SortDirection::DescendingThis finally provides a shared, type-safe representation of sort direction.
function buildOrderBy(
string $field,
SortDirection $direction,
): string {
return $field . ' ' . match ($direction) {
SortDirection::Ascending => 'ASC',
SortDirection::Descending => 'DESC',
};
}
echo buildOrderBy('created', SortDirection::Descending);Libraries have historically represented sorting through strings, integers, booleans or custom enums. A common built-in type gives the ecosystem an API that can gradually be shared across libraries.
Default values for readonly properties
PHP 8.6 relaxes one restriction of readonly properties: an instance readonly property can now declare a default value directly.
final readonly class ApiConfiguration
{
public string $version = 'v1';
public int $timeout = 30;
}The default value counts as the initialization of the property, which means it cannot subsequently be overwritten by the constructor.
This is convenient for immutable value objects, DTOs and configuration classes containing fixed values.
DocComments directly on parameters
PHP 8.6 allows DocComments to be attached directly to function parameters and adds ReflectionParameter::getDocComment().
function search(
/** Search terms */
string $query,
/** Maximum number of results */
int $limit = 10,
): array {
return [];
}
$parameter = new ReflectionParameter('search', 'query');
var_dump($parameter->getDocComment());This can be useful for reflection-heavy frameworks, documentation generators, dependency-injection tools and schema-generation systems.
More accurate property Reflection
With readonly properties, property hooks and asymmetric visibility, checking whether a property is simply public is no longer always enough to determine whether it can actually be read or written.
PHP 8.6 therefore adds:
ReflectionProperty::isReadable()
ReflectionProperty::isWritable()These APIs take the effective property context into account rather than exposing only its declared visibility.
Improved stream error handling
PHP 8.6 introduces structured error handling for stream-based operations.
Applications can configure supported stream operations to throw a StreamException instead of relying exclusively on PHP warnings.
$context = stream_context_create([
'stream' => [
'error_mode' => StreamErrorMode::Exception,
],
]);
try {
$contents = file_get_contents(
'/path/to/file.txt',
context: $context,
);
} catch (StreamException $exception) {
foreach ($exception->getErrors() as $error) {
error_log($error->message);
}
}PHP also adds stream_last_errors() and stream_clear_errors().
For application and library code, this is a much cleaner alternative to patterns built around @file_get_contents() and error_get_last().
Safer session defaults
PHP 8.6 changes several session defaults:
session.use_strict_modeis enabled;session.cookie_httponlyis enabled;session.cookie_samesitedefaults toLax.
Strict mode helps mitigate session-fixation attacks.
Applications using a custom session handler should also check its implementation: handlers that do not correctly provide create_sid() and validateId() now trigger deprecations.
New cryptographic APIs in Sodium
PHP 8.6 substantially expands the Sodium extension.
When built against libsodium 1.0.22 or newer, PHP exposes X-Wing, a hybrid ML-KEM-768 and X25519 key-encapsulation mechanism, as well as ML-KEM-768 itself. PHP 8.6 also adds SHAKE, TurboSHAKE and IPcrypt APIs.
These features are primarily relevant to cryptographic libraries and protocols beginning to adopt post-quantum primitives.
URI, Intl, MySQLi and Zip improvements
Other notable PHP 8.6 additions include:
Uri\Rfc3986\UriBuilderandUri\WhatWg\UrlBuilderfor constructing URIs;ZipArchive::openString()andZipArchive::closeString()for in-memory archives;grapheme_strrev()for grapheme-aware string reversal;IntlNumberRangeFormatterfor formatting numeric ranges;mysqli::quote_string(), similar in purpose toPDO::quote().
Performance improvements
PHP 8.6 includes a number of targeted engine optimizations.
PHP.net specifically mentions:
- compiling some
array_map()calls into loops when using first-class callables or partial application; - faster
printf()calls; - caching stateless closures;
- faster JSON encoding.
There is no official universal percentage saying that a real PHP or Drupal application will become a fixed amount faster. Performance gains depend heavily on the workload, so production-like benchmarks remain the correct way to assess the impact.
Important PHP 8.6 deprecations
PHP 8.6 also prepares the ecosystem for future removals in PHP 9.
Returning from finally
A return statement inside finally is now deprecated.
function load(): array
{
try {
return loadData();
} finally {
return [];
}
}This construct can silently swallow exceptions or override the value returned by the associated try or catch block.
spl_object_hash()
spl_object_hash() is deprecated in favor of:
spl_object_id($object);This is particularly relevant to Drupal: Drupal's PHP 8.6 compatibility work has already identified usages of spl_object_hash() that need to be updated.
mbregex functions
The mbregex family is deprecated and scheduled for removal in PHP 9, including APIs such as:
mb_ereg()
mb_ereg_match()
mb_ereg_replace()
mb_ereg_replace_callback()
mb_split()
...For many use cases, PHP recommends moving to PCRE functions such as preg_match(), preg_replace() and preg_split() with the Unicode u modifier.
Legacy type aliases
The following aliases are deprecated:
is_double() → is_float()
is_long() → is_int()
is_integer() → is_int()
doubleval() → floatval()strcoll() and SORT_LOCALE_STRING
strcoll() and SORT_LOCALE_STRING are deprecated. PHP recommends using the Intl extension's Collator API for locale-aware collation.
Objects implicitly treated as arrays
PHP continues to remove APIs that silently interpret objects as arrays. PHP 8.6 deprecates this behavior in functions including:
array_walk()
array_walk_recursive()
http_build_query()
mb_convert_variables()If an object really needs to be converted, make the conversion explicit, for example with get_object_vars().
Backward compatibility changes
Some PHP 8.6 changes can alter existing behavior.
trim(), ltrim() and rtrim() now remove form feed \f by default.
var_dump(trim("\f hello \f"));
// PHP 8.6: "hello"Several functions now throw a ValueError for invalid flags, out-of-range values or NUL bytes instead of silently accepting or truncating invalid data.
fclose(), file_put_contents() and copy() can now return false when flushing or closing the underlying stream fails.
These changes generally make failures more explicit but may expose incorrect assumptions in legacy code.
PHP 8.6 and Drupal: should you upgrade now?
For a production Drupal site, I would not switch to PHP 8.6 until the Drupal branch you use officially lists it as supported.
As of November 20, 2026, Drupal's official PHP requirements still refer users to core issue #3608511 for PHP 8.6 support.
Work is already well underway. Drupal has been running PHP 8.6 in CI and the compatibility effort has uncovered issues in Drupal Core and dependencies. That does not yet make PHP 8.6 an officially supported production target.
| Status | Recommendation |
|---|---|
| PHP 8.6 stable | Yes, at the PHP project level |
| Drupal testing on PHP 8.6 | Yes, in development and CI |
| Production Drupal on PHP 8.6 | Wait for official Drupal and dependency support |
The situation is likely to evolve quickly around Drupal 11.5 and Drupal 12, where PHP 8.6 compatibility work is part of the current development cycle.
What about Symfony?
Symfony 7.4 LTS requires PHP 8.2 or newer, while Symfony 8.1 requires PHP 8.4 or newer.
Those minimum constraints do not inherently block PHP 8.6, but they do not prove that every package in an application's dependency graph is already free from PHP 8.6 deprecations or compatibility issues.
You therefore need to test the complete Composer dependency graph, not Symfony alone.
Composer checks before upgrading
Use a recent Composer release before testing PHP 8.6. Composer 2.11.1 explicitly fixed a PHP 8.6 deprecation, and Composer 2.11.2 is the current stable release at the time of writing.
To identify dependencies that block PHP 8.6:
composer prohibits php 8.6or:
composer why-not php 8.6Once the project is installed in an environment actually running PHP 8.6:
composer check-platform-reqsAnd check known package vulnerabilities with:
composer auditAvoid using --ignore-platform-reqs as a migration strategy. It can be useful as a diagnostic tool, but ignoring a package constraint does not make incompatible code compatible.
A safe PHP 8.6 migration strategy
- Update Composer and project dependencies while still running the currently supported PHP version.
- Run
composer prohibits php 8.6. - Create a development or CI environment that actually runs PHP 8.6.
- Make sure
E_DEPRECATEDmessages are visible in tests and logs. - Run PHPUnit and all other automated test suites.
- Test CLI commands, workers, cron jobs, queues and asynchronous tasks.
- Check extensions and platform requirements with
composer check-platform-reqs. - Review logs for PHP 8.6 deprecation warnings.
- Benchmark representative workloads before and after the upgrade.
- For Drupal, wait until the exact Drupal branch is officially compatible before switching production.
Is PHP 8.6 worth adopting quickly?
For standalone PHP applications whose dependency graph is already compatible, PHP 8.6 is a compelling release. Partial Function Application improves expressiveness, Time\Duration provides a standard duration type, structured stream errors make failure handling more robust and Io\Poll provides a stronger foundation for highly concurrent PHP applications.
For Drupal, the answer is more conservative: add PHP 8.6 to development and CI early so you can detect deprecations and dependency issues, but keep production aligned with Drupal's official support matrix.
PHP 8.6 FAQ
When was PHP 8.6 released?
PHP 8.6.0 was officially released on November 19, 2026.
How long will PHP 8.6 be supported?
PHP 8.6 receives active support until December 31, 2028 and critical security support until December 31, 2030.
What are the biggest PHP 8.6 features?
Major additions include Partial Function Application, Time\Duration, the Io\Poll API, clamp(), SortDirection, readonly property defaults and structured stream error handling.
Does Drupal support PHP 8.6?
As of November 20, 2026, official Drupal Core support is still being finalized. Testing PHP 8.6 in development and CI is useful, but production sites should wait until their Drupal branch is officially listed as compatible.
Does Symfony work with PHP 8.6?
Recent Symfony branches have minimum PHP constraints that do not inherently exclude PHP 8.6. However, every application also depends on third-party packages, so the full Composer dependency graph needs to be checked and tested.
How can I check whether Composer dependencies allow PHP 8.6?
Run:
composer prohibits php 8.6Then validate the actual runtime environment with:
composer check-platform-reqsConclusion
PHP 8.6 is a substantial release focused on language expressiveness, safer APIs and foundations for modern PHP workloads.
Partial Function Application should simplify many callbacks. Time\Duration finally gives PHP a standard representation of elapsed time. Io\Poll creates a stronger foundation for event loops and concurrent workloads, while stream, session and Reflection improvements make APIs more predictable and robust.
As always, a new PHP version should not go directly into production just because it is available. Test early, fix deprecations, check Composer dependencies and follow the compatibility policy of the framework or CMS your application relies on.
For Drupal specifically, PHP 8.6 is already an excellent CI and development target, but production adoption should wait for official support of the Drupal branch in use.